Top
Home


Dynamic Drop Down (HTML5)

<?php
$conn = mysql_connect("{{ HOST }}", "{{ USERNAME }}", "{{ PASSWORD }}");
mysql_select_db("{{ DATABASE }}");
$result=mysql_select_db($dbName,$conn);
?>

<input name="{{ FORMFIELD }}" list="{{ FORMFIELD }}" type="text" />
<datalist id="{{ FORMFIELD }}">
<?php
$results= mysql_query("SELECT distinct {{ FORMFIELD }} from {{ TABLE }} Order by {{ FORMFIELD }}");
echo mysql_error();
if (mysql_Numrows($results)>0)
{
$numrows=mysql_NumRows($results);
$x=0;
while ($x<$numrows){
$theName=mysql_result($results,$x,${{ FORMFIELD }});
echo "<option value="$theName">$theName</option>n";
$x++;
}
}
?>
</datalist>