Page 1 of 1

phpscipt for customers information from database in dropdown

Posted: Thu Aug 03, 2006 11:48 am
by david23
Hi Guys,

I have an application script in php and in one page it is having customer search option in text box.If i want to search for one customer i need to enter the customer name in text box and it will display the details and other stuff about the customer from database.Now my client want dropdown box with all the customer names existing in database so that it will be easy for them to view all the customers.

Database :- mysql
Language :- php

Variables defined

$customer = $_GET['customer'];

echo "Customer: $customer <BR>\n";


How to implement this and i really appriciate your help.

Best Regards

Posted: Thu Aug 03, 2006 11:57 am
by tecktalkcm0391
Something like
UNTESTED:

Code: Select all

print('  <select name="select" id="select">' );

$query = mysql_query("SELECT customer_name FROM databasetable ORDER BY customer_name");
$customers = mysqk_fetch_array();
foreach($customers['customer_name'] as $name){
    print("<option>$name</option>");
}
print('</select>');
And then what ever you want to do with the list...

feyd | *grumble* tags.