okay, this is the code but there isn't much more than there was before ...
<form action="<?php print $PHP_SELF?>" name="thisForm" method="POST">
<?php
$celltext=" ";
// date option drop downs
if ( ! checkdate($month, $day, $year) )
{
$nowArray = getdate();
$day = $nowArray[mday];
$month = $nowArray[mon];
$year = $nowArray[year];
}
$start = mktime (0, 0, 0, $month, $day, $year );
// date used in adding date lines
$start2 = mktime (0, 0, 0, $month, $day, $year );
$firstDayArray = getdate ($start);
echo '<select name="day" onChange="document.thisForm.submit()">';
for ($x=1; $x<=31; $x++)
{
if (checkdate($month, $x, $year)) // add if valid day number for month
{
print "<option value=".$x;
//print $x.date(S);
print ($x == $day) ? " SELECTED":"";
print ">".$x;
}
}
print "</select>";
echo '<select name="month" onChange="document.thisForm.submit()">';
$months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
for ($x=1; $x <= count($months); $x++)
{
print "\t<option value=\"$x\" ";
print ($x == $month) ? " SELECTED":" ";
print ">".$months[$x-1]."\n";
}
echo ' </select> ';
echo '<select name="year" onChange="document.thisForm.submit()">';
for ($x=1998; $x<2004; $x++)
{
print "\t<option";
print ($x == $year) ? " SELECTED":" ";
print ">$x\n";
}
echo ' </select> ';
echo '';
?>
</form>
bits of it have been cut out as it is part of a much larger page.
as i lost the code that was originally requested then it was quite difficult to answer the question so i re-read all the previous posts to get an idea.
what seemed really wierd was that it sounded like a hundred years ago that i asked the original question, and after only 2 or 3 months of using php it seems really odd.
what you need to do is create a form and set the action of the form the call itself using:
action="<?php print $PHP_SELF?>"
this means that you can set the onChange part of the select to refresh the form when a user chooses a value from the drop down list.
so for the states example have a list of all the states called states.
then set the onChnage to refresh and once that is doen a variable will be available on the page called $states.
this will hold the value of the drop down box.
your second query will have to use if (isset($states)) to determine iof the user has chosen a value and then use the second query to refine itself on that value.
e.g.
user chooses the state with a value 2 from srop down 1.
form refreshes and $states has value 2.
chekc whether isset($states) and then fire query 2 using the value of $states in the 'where' clause e.g. "select towns from states_list where states_id=".$states." order by towns"
the above example uses:
print ($x == $day) ? " SELECTED":"";
to set a value for the list so i guess it wasn't the best example and i guess it could be a bit confusing.
hope this helps anyways.
Steve