I would like for the drop down box to have a list of the states within my database but without duplicating them. My code: <h1>Step1: Choose Your State</h1> <center> <form action=\"builders.php\" method=\"post\"> State: <select name=\"state\" onChange=\"this.form.submit();\"> <option>Choose State</option> <option>----------------------------</option> "; $result = mysql_query("SELECT * FROM builders ORDER BY builderstate ASC"); while($row = mysql_fetch_array($result)) { echo "<option value=\"" . $row['builderstate'] . "\">" . $row['builderstate'] . "</option>"; echo "<br />"; } echo " </select> <input type=\"hidden\" name=\"stateselected\" value=\"1\"> </form> </center> Code (markup): If there are 2 builders with the same state the state will show up as 2 options. I need it to only show up once. Thank you in advance.
I got it figured out you just have to add DISTINCT to the SELECT line: $result = mysql_query("SELECT DISTINCT builderstate FROM builders ORDER BY builderstate ASC");