Hi, I looked up the following post
http://www.phpbuilder.com/board/showthread.php?s=&threadid=10208147
but am not sure how i can adapt it to my requirement. I need to update a customer table. So if a user types in abc company in the form field, a list of all firms with the words abc company in them should come up.
I dont think this script i have is particularly efficient and i would like to convert both the scripts into a single one like the one i have seen above . Can anyone guide me on how i could accomplish this ? Thanks.
1st file
<? include("protect.php"); ?>
<form method="post" action="update_customer.php">
Company:<input type="text" size="12" name="customer">
<input type="submit" value="Search">
</form>
2nd file
<? include("protect.php"); ?>
<?php
$customer = $_POST["customer"];
?>
<b>These are the customers in your database in the selected alphabet. Select one to update.</b></font><p>
<table border="1" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr bgcolor="#DEEDFE">
<form method="post" action="update_customer_chosen.php">
<td><b><font size=2 face=Tahoma color=blue>Select</b></td>
<td><b><font size=2 face=Tahoma color=blue>Company</b></td>
<td><b><font size=2 face=Tahoma color=blue>City</b></td>
<td><b><font size=2 face=Tahoma color=blue>State</b></td>
<td><b><font size=2 face=Tahoma color=blue>First Name</b></td>
<td><b><font size=2 face=Tahoma color=blue>Last Name</b></td>
<tr>
<?php
mysql_connect("localhost", $dbname, $dbpasswd )
or die ("Unable to connect to server.");
mysql_select_db("$database")
or die ("Unable to select database.");
$resulta = mysql_query("SELECT * FROM `Customers`WHERE `Company` LIKE '%$customer%' ORDER BY `Company` asc ") or die (mysql_error ());
echo $sqla;
do {
printf("<tr><td><input type=\"checkbox\" name=\"choice\" value=%d><td>
<font size=2 face=Tahoma color=blue>%s<td>
<font size=2 face=Tahoma color=blue>%s<td>
<font size=2 face=Tahoma color=blue>%s<td>
<font size=2 face=Tahoma color=blue>%s<td>
<font size=2 face=Tahoma color=blue>%s<td>
</tr>",
$myrowa["Customerid"],
$myrowa["Company"],
$myrowa["Business City"],
$myrowa["Business State"],
$myrowa["First Name"],
$myrowa["Last Name"]);
} while ($myrowa = mysql_fetch_array($resulta));
?>
</table>
<p><input type="submit" value="Select">
</form>