Hi--

I hope all of you are having a great long weekend!

Let's say I have four (4) tables:

- "campus" that holds all my campuses' names (only 3),
- "building_campus1" that holds all buildings for 'campus1',
- "building_campus2" that holds all buildings for 'campus2',
- "building_campus3" that holds all buildings for 'campus3'.

If the user selects "campus 1" from a drop-menu, how can I select 
"buildings for campus 1" on a second drop-down menu?  In other words, how 
do I select the corresponding "building's table" when any "campus" is selected?

Thanks!

P.S.  I have tried the 'onChange' command, but I guess I got the syntax wrong:

=================================================================
// $campus:
<?php
echo("<SELECT onChange='building.value = building.this.value' NAME='campus'>");
$cmlist = @pg_exec($db, "SELECT * FROM \"Campus\"") or 
die(include("../sqlerror.inc"));
$i = 0;
$x = pg_numrows($cmlist);
while ($i < $x):
         $clist = pg_fetch_array($cmlist,$i);
         echo "<OPTION 
VALUE='".$clist["Campus"]."'>".$clist["Campus"]."</OPTION>";
         $i++;
endwhile;
echo("</SELECT>");
?>

$building:
<?php
echo("<SELECT NAME='building'>");
$cmlist = @pg_exec($db, "SELECT * FROM building_$campus") or 
die(include("../sqlerror.inc"));
$i = 0;
$x = pg_numrows($cmlist);
while ($i < $x):
         $clist = pg_fetch_array($cmlist,$i);
         echo "<OPTION 
VALUE='".$clist["Building"]."'>".$clist["Building"]."</OPTION>";
         $i++;
endwhile;
echo("</SELECT>");
?>
=================================================================

Julio Cuz, Jr.
Riverside Community College
[EMAIL PROTECTED] 

Reply via email to