I have used previous posts and reading thru PHP manual to write/copy this code. What I am trying to accomplish is the creation of 2 drop down menus. Once the first variable(client) is selected, the second drop down should list the 2 other variables (eventname, eventno) listed together. Once the eventname is selected I want to be wisked away to editevent.php3, which will echo information from fields in my MySQL db. Then I can utilize this form to update/delete events for a particular client. So far the code will show the 2 drop downs and even shows the "test" clients I have created. But once a client is selected, it shows no variables selected. I also have not included editevents.php3 in the code, as I am unsure how to accomplish this. I am including code below. Can someone PLEASE help me!
Thanks,
Jeff Harris
<form name=eventeditor action=<?php echo $PHP_SELF; ?> method=post>
<?php
//db connection stuff
// create connection
mysql_connect("localhost", "***", "*")
or die("Couldn't make connection.");
// select database
mysql_select_db("auction")
or die("Couldn't select database.");
$query = mysql_query("SELECT client FROM events ORDER
BY client");
echo "<select client onchange=\"document.eventeditor.submit();\">\n";
if (!isset($client)) { echo "<option value=null selected>Choose a Client</option>\n";}
while(list($client) = mysql_fetch_row($query))
{
echo "<option value=$client";
echo ">$client</option>\n";
}
echo "</select>\n";
echo "<select client onchange=\"document.eventeditor.submit();\">\n";
if (!isset($client)) { echo "<option value=null selected>Choose Client First</option>\n";
}
else
{
$result = mysql_query("SELECT eventname, eventno FROM events
ORDER BY eventname");
echo "<option value=null selected>Choose an Event</option>\n";
while(list($eventname,$eventno) = mysql_fetch_row($result))
{
echo "<option value=$eventname";
echo ">$client</option>\n";
}
}
echo "</select>\n";
?>