does anyone have a better script for a self populating select box ?? this is the one i am currently using but for some reason if there is more than one word in the selection box - updates do not work even though the entries exist ... it just cant deal with more than one word selections.
<?php
$table="scholarship"; // name of the table
$limit="20"; // limit # of records in select box
$orderBy="level"; // Usually a column name
$conn = pg_connect("","","","","funds");
if
(!$conn)
{echo "Could not make a connection";exit;}
$sql = "SELECT DISTINCT level FROM $table order by $orderBy;";
$select_box = pg_Exec($conn, $sql);
$numrecords = pg_NumRows($select_box);
echo "<select name=select>";
//pre selected option
echo"<option value=none>select type</option>";
//loop through database to populate select box
for ($j=0; $j < $numrecords; $j++) {
$value = pg_result($select_box, $j, "level"); //column name for the value of the checkbox
$option = pg_result($select_box, $j, "level"); // select option column name
echo"<option value=$value>$option</option>";
}
echo"</select>";
?>