yes - i did try that actually - it only works when all 3 selections are made that way though.
here's my form which uses three - self populating scripts🙁the defaults are given a value of 'none' is this the wrong thing to be referring to ?) i tried a blank instead and that made no difference:
print ("<table border=\"0\" width=\"100%\"><form action=\"search.php\" method=\"post\">\n");
print ("<tr>
<td width=\"140\" bgcolor=\"#cccccc\" valign=\"top\"><b>Agency : </b></td>
<td width=\"500\">");
$table="agency"; // name of the table
$orderBy="agency_name"; // Usually a column name
$conn = @pg_connect("","","","","funds");
if(!$conn)
{echo "Could not make a connection";exit;}
$sql = "select distinct from agency order by agency_name";
$select_box = pg_Exec($conn, $sql);
$numrecords = pg_NumRows($select_box);
echo "<select name=\"agency_name\">";
echo"<option value=\"none\">Select from previously entered Agencies</option>";//pre selected option
for ($j=0; $j < $numrecords; $j++) //loop through database to populate select box
{
$value = pg_result($select_box, $j, "agency_name"); //column name for the value of the checkbox
$option = pg_result($select_box, $j, "agency_name"); // select option column name
echo"<option value=\"$value\">$option</option>";
}
echo"</select><br>";
print ("<tr>
<td width=\"140\" bgcolor=\"#cccccc\" valign=\"top\"><b>Field of Study : </b></td>
<td width=\"427\">");
$table="field"; // name of the table
$orderBy="field"; // Usually a column name
$conn = @pg_connect("","","","","funds");
if(!$conn)
{echo "Could not make a connection";exit;}
$sql = "select distinct from $table order by $orderBy;";
$select_box = pg_Exec($conn, $sql);
$numrecords = pg_NumRows($select_box);
echo "<select name=\"field\">";
echo"<option value=\"none\">Select Field of Research</option>";//pre selected option
for ($j=0; $j < $numrecords; $j++) //loop through database to populate select box
{
$value = pg_result($select_box, $j, "field"); //column name for the value of the checkbox
$option = pg_result($select_box, $j, "field"); // select option column name
echo"<option value=\"$value\">$option</option>";
}
echo"</select>";
print ("<tr>
<td width=\"140\" bgcolor=\"#cccccc\" valign=\"top\"><b>Level of Study : </b></td>
<td width=\"427\">");
$table="level"; // name of the table
$orderBy="level"; // Usually a column name
$conn = @pg_connect("","","","","funds");
if(!$conn)
{echo "Could not make a connection";exit;}
$sql = "select distinct* from $table order by $orderBy;";
$select_box = pg_Exec($conn, $sql);
$numrecords = pg_NumRows($select_box);
echo "<select name=\"level\">";
echo"<option value=\"none\">Select Level of Study</option>";//pre selected option
for ($j=0; $j < $numrecords; $j++) //loop through database to populate select box
{
$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>";
echo"<tr><td></td><td><input type=\"submit\" value=\"Search\">";
echo"<input type=\"reset\" value=\"Reset menu\"></td></tr>";
echo"</form>";
and heres the portion of the script conducting the search script :
<?php
$db = @pg_connect("","","","","funds");
if (!$db) {echo "Could not connect to the Funding database"; exit;}
$query = "Select * from scholarship where (level='$level' and field='$field' and agency_name='$agency_name')
OR (level='$level' and field='$field' and agency_name='none') OR (level='$level' and field='none' and agency_name='$agency_name') OR (level='none' and field='$field' and agency_name='$agency_name')
OR (level='$level' and field='none' and agency_name='none') OR (level='none' and field='$field' and agency_name='none') OR (level='none' and field='none' and agency_name='$agency_name')";
$result = @pg_exec($db, $query);
$color1 = "#EEEEF8";
$color2 = "#ffffff";
$numrows = @pg_numrows($result);