/ Published in: PHP
This snippet allows you to dynamically generate an HTML form drop down box which is populated by the values contained within a MySQL table called country. Use in conjunction with http://snipplr.com/view/36728/mysql-country-table-with-abbreviations-and-names/ to actually create the drop down box.
Expand |
Embed | Plain Text
$sql = "select country_name,country_abbrev from country order by country_name"; } print '<select name="country"><br>\n'; print '<option value=""> - Select Country - '; $country_name = $row[0]; $country_abbrev = $row[1]; print "<option value=\"$country_abbrev\""; print "> $country_name <br>\n"; } print '</select>';
You need to login to post a comment.
