HTML/Javascript

SES by business degree online promotion team.

Philippine Airlines International Flight schedules

Philippine Airlines International Flight schedules
Philippine Airlines International Flight schedules

Search This Blog

Tuesday, September 14, 2010

Dynamic Combo Box

Using php code, you can get data from mysql database then put the data inside your option value.
This can be useful sometimes if you need to put data base from mysql database, then put value to your combo box.



code to paste:

note: Start php code. see ex. <?php and end with?>
//*put code connecting to the database*//

echo "<tr>";
echo "<td align='right'><font face='verdana' size='2'>Location:</font></td>";
echo "<td>";


$result = mysql_query("SELECT * FROM location order by location");
echo "<select name='location'>";
echo "<option>----Select Location----</option>";
while($row = mysql_fetch_array($result))
{
echo $location = $row['location'];
echo "<option value='$location'>$location</option>";
}

echo "</select>";
echo "</tr>";

//*close database*//

No comments:

Post a Comment