Hi, I have a problem. I would like to, from a text form, filter out what the user wants to see. I have a mysql database with info on every order placed. Each row is a new order. All users has their own ID. I would like the users to enter their ID and click collect and the database will show all orders with that ID.
Here's my code so far:
<?php
if ($searchstring)
{
$sql="SELECT * FROM Blad1 WHERE '%$searchstring%' = ID";
include('connect.php');
$result = mysql_query($sql,$db);
echo "<table border=1 align=center cellspacing=2 cellpadding=3>\n";
echo "<TR><TH>Referens<TH>ID<TH>Kund</TR>\n";
while ($rad = mysql_fetch_array($result))
{
echo "<TR><TD>$rad[referens]<TD>$rad[ID]<TD>$rad[Kund]\n";
}
echo "</TABLE>";
}
else
{
?>
<form method="POST" action="<?php $PHP_SELF ?>">
<table border="1" align="center" cellspacing=2 cellpadding=3>
<tr><td>Sök här</td>
</tr>
<tr>
<td><input type="text" name="searchstring" size="40"></td>
</tr>
</table>
<p align="center">
<input type="submit" value="Search" name="B1">
<input type="reset" value="Clear" name="B2">
</p>
</form>
<?php
}
?>