I-AM-OBODO Posted April 20, 2012 Share Posted April 20, 2012 Hi all, i want my list/menu field values to come from my database. how can i accomplish that? thanks i did <select name="select"> <option value="0">--select below--</option> <option value="1">Me</option> <?php require_once '../konnect/konex.php'; $result = mysql_query("SELECT * FROM is_clients"); while($row = mysql_fetch_array($result)) { echo "<option value ='2'>".$row"['name']</option>"; echo "<br />"; } ?> </select> Quote Link to comment https://forums.phpfreaks.com/topic/261345-listmenu-values-from-database/ Share on other sites More sharing options...
DavidAM Posted April 20, 2012 Share Posted April 20, 2012 echo "<option value ='2'>".$row"['name']</option>"; 1) You've got a mis-placed double-quote in there 2) You're missing a concatenation operator 3) Having the same "value" for all of them will not be very helpful echo "<option value ='" . $row['id'] . "'>" . $row['name'] . "</option>"; Quote Link to comment https://forums.phpfreaks.com/topic/261345-listmenu-values-from-database/#findComment-1339236 Share on other sites More sharing options...
I-AM-OBODO Posted April 21, 2012 Author Share Posted April 21, 2012 echo "<option value ='2'>".$row"['name']</option>"; 1) You've got a mis-placed double-quote in there 2) You're missing a concatenation operator 3) Having the same "value" for all of them will not be very helpful echo "<option value ='" . $row['id'] . "'>" . $row['name'] . "</option>"; thanks. gat it now Quote Link to comment https://forums.phpfreaks.com/topic/261345-listmenu-values-from-database/#findComment-1339252 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.