unistake Posted October 21, 2010 Share Posted October 21, 2010 Something is wrong with this drop down form menu. The name of the option appears and works well however the value does not seem to work. Any ideas? Thanks <?php include("cxn.php"); $query = "SELECT manufacturer FROM list ORDER BY manufacturer ASC"; $result = mysqli_query($cxn,$query) or die(mysqli_error()); ?> <select name="manufacturer" id="manufacturer"> <option value="" selected="selected">Select a Manufacturer..</option>"; <?php while($row = mysqli_fetch_row($result)){ echo "<option value=\"".$row[0]."\">".$row[0]."</option>"; // SHOWS ALL MANUFACTURERS CURRENTLY ADVERTISED WITH THE NUMBER OF ADVERTS NEXT TO THE MANUFACTURER } ?> Quote Link to comment Share on other sites More sharing options...
benji_182 Posted October 21, 2010 Share Posted October 21, 2010 Hmmm, personally I'd try it like this. <?php include("cxn.php"); $query = "SELECT manufacturer FROM list ORDER BY manufacturer ASC"; $result = mysqli_query($cxn,$query) or die(mysqli_error()); ?> <select name="manufacturer" id="manufacturer"> <option value="" selected="selected">Select a Manufacturer..</option>"; <?php while ($row = mysqli_fetch_row($result)) { echo "<option value=\"{$row["fieldname1"]}\">{$row["fieldname2"]}</option>"; } ?> </select> Hope this helps. Quote Link to comment Share on other sites More sharing options...
Colton.Wagner Posted October 21, 2010 Share Posted October 21, 2010 You did not echo the <select> tag or the first <option> or the closing </select> tag. Revised code: <?php include("cxn.php"); $query = "SELECT manufacturer FROM list ORDER BY manufacturer ASC"; $result = mysqli_query($cxn,$query) or die(mysqli_error()); echo "<select name=\"manufacturer\" id=\"manufacturer\">"; echo "<option value=\"\" selected=\"selected\">Select a Manufacturer..</option>"; while($row = mysqli_fetch_row($result)){ echo "<option value=\"".$row[0]."\">".$row[0]."</option>"; // SHOWS ALL MANUFACTURERS CURRENTLY ADVERTISED WITH THE NUMBER OF ADVERTS NEXT TO THE MANUFACTURER } echo "</select>"; ?> Quote Link to comment Share on other sites More sharing options...
unistake Posted October 21, 2010 Author Share Posted October 21, 2010 they are there in between the two php scripts. (in black above) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.