Now, I have set up a form in HTML. I have give the various things (couple of text boxes and select options). I have given then names.
I have then sent the values over to another page.
I have then got the following to get the values from the database depending on what the user has typed in/selected in the form...
Code: Select all
$query = "SELECT * FROM books WHERE Book_Title='$book' OR Author='$authors' OR Price='$price' OR Publication_Year='$year' OR Origin_Country='$origin' OR Condition='$condition'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['Book_Title']. " - ". $row['Author'];
echo "<br />";
}Code: Select all
$book=$_POST['books'];
$authors=$_POST['author'];
$price=$_POST['price'];
$year=$_POST['year'];
$origin=$_POST['origin'];
$condition=$_POST['condition'];So how would I display the data in the database depending on what the user searches for.