Customer directory using PHP

timer Asked: Nov 19th, 2013

Question description


Your task is to create a customer directory using php. Directory allows adding more customers or removing existing ones. Directory also allows fetching customer information and printing it. Customers are identified by a customer id number. Depending on the value of parameter mode, sent as hidden field, different actions can be performed. If the value is save, a customer is added. If it's delete, a customer should be deleted. With any other value the program shows customer info. If customer id is not found, no printing is done. The customer information is stored in the file directory.txt which contains, for each customer, customer id, name and address. Each of these items are separated with two hash signs and each customer has their own row. Therefore the file structure is as follows:

12345##first customer##someroad 1
54321##second customer##otherstreet 2

Forms that are used for deleting customers or retrieving customer information contain the hidden field mode and a text field called customer, which in turn contains the customer id of the customer whose information is manipulated. The form to add a new customer looks like this:

<form action="directory.php" method="get">

customerid: <input TYPE="text" name="customerid"><br>

name: <input TYPE="text" name="name"><br>

address: <input TYPE="text" name="address"><br>

<input type="hidden" name="mode" value="save">

<input type="submit" value="Send">     


Tutor Answer

(Top Tutor) Studypool Tutor
School: Rice University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors