I have a page I am putting together that has a drop down box, and allows me to choose an item from the drop down, and then it queries the database matching from the drop down to a table field and then grabs all database entries that match.
That part works perfect.
However I have two problems:
#1 If you reload the page the database items are still there. How can I wipe the results each page refresh.
#2 The format of the output is 1 after the other. I would like to format the output side by side as in a table. However I would rather do this with div tags for a cleaner output.
Here is the code:
<body>
<form method="post" action="">
<select name="Manufacturer" >
<option value="Apple">Apple</option>
<option value="Motorolla">Motorolla</option>
</select><br />
<input type="submit" value="submit" name="submit"><br />
</form>
</body>
<?php
$Manufacturer = $_POST["Manufacturer"];
?>
<br />
<br />
<br />
<?php
mysql_connect("localhost", "user", "password") or die(mysql_error()) ;
mysql_select_db("phones") or die(mysql_error()) ;
//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM phones where Manufacturer='$Manufacturer'") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data ))
{
//Outputs the image and other data
Echo "<div id=cell>";
Echo "<img src=images/".$info['Image'] ."> <br /> ";
Echo "<b>Model:</b> ".$info['Model'] . "<br />";
Echo "<b>Price: $</b> ".$info['Price'] . "<hr>"; }
Echo "</div>"
?>
</body>
</html>