would i be able to change this code to display the results of a search the user as made?
this is just the code that displays all the products in my table. i want the user to be able to enter a keyword.
function chooser() {
/ puts up a form to choose from a list of products
The products have to be stored in a comma-separated file
with the structure (Product,Product URL, Description,Price).
The form posts to a page "addToBasket.php3".
$fname is the name of the file.
/
global $table_products, $table_basket;
?> <!-- output the column headers -->
<FORM METHOD="POST" ACTION="<?php echo("addToBasket.php3"); ?>">
<TABLE border = 1> <TR>
<TD ALIGN="center"> <em>Product</TD>
<TD ALIGN="center"> <em>Description</TD>
<TD ALIGN="center"> <em>Price</TD>
<TD ALIGN="center"> <em>URL</TD>
<TD ALIGN="center"> <em>Qty ordered</TD>
</em></TR>
<?php
/* now work through the products file, creating a table with a
data entry field to contain the quantity ordered */
$dbcnx = myConnect();
$query = "SELECT PROD_ID, PROD_NAME, PROD_PRICE, PROD_URL FROM $table_products";
$result=mysql_query($query);
if (! $result) printf ("Error: %s<br>", mysql_error ());
for ($i = 0; $i < mysql_num_rows ($result); $i++) {
$row = mysql_fetch_row($result);
echo("<tr>");
for($j = 0 ; $j<mysql_num_fields($result); $j++) {
echo("<td>");
if($j==3) echo "<a href=\"".$row[$j]."\" target=\"_blank\">".$row[$j]."</a>";
else echo($row[$j]);
echo("</td>");
};
echo("<TD><INPUT TYPE=TEXT NAME=QUANTITY[");
echo($row[0]);
echo("] SIZE=3></tr>");
};
?>
</TABLE>
<INPUT TYPE=SUBMIT VALUE="Submit Form">
<INPUT TYPE=RESET VALUE="Reset Form">
</FORM>
<?php };