Notice the TOOLS menu item on the right - chock full o' forms and is working well AFAICT.
Notice the Sponsor Statement pull down list menu on the LEFT of the page near the top. This list is dynamically created from a mySQL database table using PHP. See the call to the function "selectMenu" below:
Code: Select all
<?php
selectMenu($connection,"statement","ss_num","ss_num","","");
?>
Code: Select all
function selectMenu($connection,$tableName,$columnName,$pulldownName,$addOption,$defaultValue)
{
//Query to find distict values for $columnName in $tableName
$distinctQuery = "SELECT $columnName, ss_id from $tableName ORDER BY $columnName";
//run the distinctQuery on the databaseName
$resultId = mysql_query ($distinctQuery,$connection);
//retrieving all distinct values
$i = 0;
while ($row = @ mysql_fetch_array($resultId))
$resultBuffer[$i++] = $row[$columnName];
//start the <select> widget
echo "\n<select name=\"$pulldownName\">";
//check for default
if (isset($defaultValue))
{
foreach ($resultBuffer as $result)
if($result == $defaultValue)
//yes show as selected
echo "\n\t<option selected>$result";
else
//no, just show
echo "\n\t<option>$result";
} //end if defaultValue
else
{
//no defaultValue
//show database values as options
foreach ($resultBuffer as $result)
echo "\n\t<option>$result";
}
echo "\n</select>";
} //function done
'course I have no clue if data strings/arrays can be handed between PHP, HTML and Javascript. Does anyone else?
Code: Select all
aI("text=</script>
<?php selectMenu($connection,'statement','ss_num','ss_num','','');?>
<input type=submit name=Submit value=read></form>
<script>;type=form;");
}