Setting variable of selected option from html form.

This may be very rudimentary. Basically I am making a college search tool. I have an html form using and a list of options for choice of college, then a list of options for choice of departments. What I would like to do is if the user selects “The college of liberal arts” I want the second options list of departments to only display departments within the college of liberal arts. Is there a way to do this? I know its possible with javascript, but am looking for something more simple if it exists.

[php]


<!first row>


College:

<?
echo “<option value=”">";
while ($row = mysql_fetch_assoc($collegeresult))
{
// GET the college column from every row.
$college_menu=$row[“COLLEGE”];
// $selected=(($table_mode==True) && ($college == $college_menu)) ? “SELECTED " : “” ;
$options.=”<OPTION “. $selected. “VALUE=”$college_menu”>".$college_menu;
}
echo $options.="";
			?>
	      </select>
	 
	 </td>
	  </tr>
	  
	  <tr> <!second row>
		<td bgcolor="#FFFFFF"></td>
        <td bgcolor="#FFFFFF">Department:
		</td>
		<td bgcolor="#FFFFFF">
			<select name="department">
			<?
				echo "<option value=\"\"></OPTION>";
					$options="";
					while ($row = mysql_fetch_assoc($DeptResult))
						{
							$dept=$row["DEPARTMENT"];
							$options.="<OPTION VALUE=\"$dept\">".$dept;
						}
					echo $options.="</option>";
			?>
		   </select>
	
		</td>
	  </tr>[/php]

What you want can be done with php, but php is a client side language, meaning you’d have to submit the option before the cascade would happen, which would mean a page refresh.

You would need to pass the option to a query and then code a select block for it. And where is your submit buttons and form tag?

The above is completely incorrect. PHP is a server side language. What you need is an AJAX double drop down. There is no page refresh necessary. Do a Google search, there are plenty of free scripts available

thats what I was thinking, however, what I think and what I type dont always come out the same. php is server side.

Sponsor our Newsletter | Privacy Policy | Terms of Service