aarbrouk Posted March 11, 2009 Share Posted March 11, 2009 <p> Brand: <select name="BrandID" id="BrandID"> <?php while ($row = mysql_fetch_assoc($result)){ $BrandID = $row['BrandID']; $BrandName = $row['BrandName'];?> <option value=<?php $BrandID?>><?php $BrandName?></option> <?php } ?> </select> Quote Link to comment https://forums.phpfreaks.com/topic/148971-populating-drop-down-box-with-attributes-from-the-mysql-database/ Share on other sites More sharing options...
aarbrouk Posted March 11, 2009 Author Share Posted March 11, 2009 <p> Brand: <select name="BrandID" id="BrandID"> <?php while ($row = mysql_fetch_assoc($result)){ $BrandID = $row['BrandID']; $BrandName = $row['BrandName'];?> <option value=<?php $BrandID?>><?php $BrandName?></option> <?php } ?> </select> sorry I submitted this thread by accident without properly explaining the problem. This is the code I have at the moment. The problem I get is when I view the form, the drop down box contains values in the drop down but doesn't actually display them on the form. The drop down just contains blank values, but they there is something there to select. help would be appreciated many thanks Quote Link to comment https://forums.phpfreaks.com/topic/148971-populating-drop-down-box-with-attributes-from-the-mysql-database/#findComment-782204 Share on other sites More sharing options...
.josh Posted March 11, 2009 Share Posted March 11, 2009 You aren't actually echoing the vars in your loop. Do: <?= $variable ?> or better yet (for compatibility), <?php echo $variable; ?> Quote Link to comment https://forums.phpfreaks.com/topic/148971-populating-drop-down-box-with-attributes-from-the-mysql-database/#findComment-782208 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.