I want a html with a dropdown menu were it's items are picked up from a mysql database. Then, when I select one of them, I want to be able to use it on a php file. Anybody has an example? Thanks
print '<form method="post" action="submit.php">';
print '<select size="1" name="myselect">';
foreach($dbresults as $r) {
print '<option value="'.$r['field'].'">'.$r['field'].'</option>';
}
print '</select>';
print '<input type="submit" value="Go!" />';
print '</form>';
And on the form's action page:
$chosen_thing = $_POST['myselect'];
您可能想研究一下在常用CMS应用程序(例如WordPress,Drupal,Joomla等)中是如何完成的。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.