Toy Posted September 12, 2010 Share Posted September 12, 2010 I have a "select"-drop down bar and I want to have a numbered list in it, i've tried but it doesn't seem to be possible. Is there any way that i'm able to do this? Quote Link to comment Share on other sites More sharing options...
Hypnos Posted September 12, 2010 Share Posted September 12, 2010 Yes, it's possible. Just echo <option value="get/post value">Number - value</option> as you're looping through your data. Need to show your code for anything more specific. Quote Link to comment Share on other sites More sharing options...
Toy Posted September 16, 2010 Author Share Posted September 16, 2010 Hmm.. I don't really understand but thanks for your time. My code goes along those lines.. <?php if(isset($_GET['id'])) { $result = mysql_query("SELECT * FROM table WHERE id='" . mysql_real_escape_string($_GET['id']) . "'"); while($display = mysql_fetch_array($result)) { echo '<option value="'. $display['id'] .'">'. $display['title'] .'</option>'; } } else { } ?> Quote Link to comment Share on other sites More sharing options...
Andy-H Posted September 16, 2010 Share Posted September 16, 2010 <?php if(isset($_GET['id'])) { $result = mysql_query("SELECT * FROM table WHERE id='" . mysql_real_escape_string($_GET['id']) . "'"); $i = 1; while($display = mysql_fetch_array($result)) { echo "\t" . '<option value="' . $display['id'] . '">' . $i . ' - ' . $display['title'] . '</option>' . "\r\n"; $i++; } } else { } ?> Quote Link to comment Share on other sites More sharing options...
Toy Posted September 16, 2010 Author Share Posted September 16, 2010 <?php if(isset($_GET['id'])) { $result = mysql_query("SELECT * FROM table WHERE id='" . mysql_real_escape_string($_GET['id']) . "'"); $i = 1; while($display = mysql_fetch_array($result)) { echo "\t" . '<option value="' . $display['id'] . '">' . $i . ' - ' . $display['title'] . '</option>' . "\r\n"; $i++; } } else { } ?> Works like a charm! Thank you. 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.