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:

if ($searchstring)
	$sql="SELECT * FROM Blad1 WHERE '%$searchstring%' = ID";
	$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>";
<form method="POST" action="<?php $PHP_SELF ?>">
  <table border="1" align="center" cellspacing=2 cellpadding=3>
    <tr><td>Sök här</td>
	<td><input type="text" name="searchstring" size="40"></td>
  <p align="center">
    <input type="submit" value="Search" name="B1">
    <input type="reset" value="Clear" name="B2">

WHERE '%$searchstring%' = ID is rather tricky. If a user enters ID = 1 then every ID with a 1 in it is returned. 1, 10, 11, and so on. If you remove the % signs, it will search for an exact match.


Problem solved!