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:

<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 />

$Manufacturer = $_POST["Manufacturer"];


<br />
<br />
<br />

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>"

The way in which you have done this, you re-display your form every time. I suspect that is why you want to clear the results on a refresh. The POST'ed values don't get deleted on a refresh so you will keep displaying them until you select a different manufacturer.

A better way to do it would be to display one or the other. Check if there is a value in $_POST["Manufacturer"] before you display the form. Only display the form if it is empty. Only display the results if it has a value. At the end of displaying the results, define a form that includes manufacturer as a hidden value with a value of empty (value = "";). The button will say something like "Display Another". This way you can toggle back and forth between displaying the form or displaying results.

To display the results side-by-side, I would personally use a table as it is the most straightforward approach. There are those who advocate other approaches through CSS and if you have the CSS knowledge to do it you can try that approach. In either case, your while loop (which seems to be missing its closing bracket) will need a variable that tells you which is next, the left side or right side. Every time you display one, you reset it to the other value. Doing it as a table, in the first case the output will have <tr><td>... and in the second it will have <td>...

Can you elaborate a little more, I really am moderate beginner