librarygal Posted April 30, 2008 Share Posted April 30, 2008 I want to direct the user to correct list depended on which dropdox box/selection they make. Clueless. :'( // Query for event name $sql = <<<EOD SELECT * from event ORDER by eventid EOD; $result = mysql_query($sql) or trigger_error("sql=$sql; " . mysql_error(),E_USER_ERROR); $events= array(); while ($row = mysql_fetch_assoc($result)) { $events[] = $event; } // Query for age groups $sql = <<<EOD SELECT * from event_agegroup ORDER by agegroupid EOD; $result = mysql_query($sql) or trigger_error("sql=$sql; " . mysql_error(),E_USER_ERROR); $agegroups = array(); while ($agegroup = mysql_fetch_assoc($result)) { $agegroups[] = $agegroup; } $sql = <<<EOD SELECT * from event_type ORDER by typeid EOD; $result = mysql_query($sql) or trigger_error("sql=$sql; " . mysql_error(),E_USER_ERROR); $types = array(); while ($type = mysql_fetch_assoc($result)) { $types[] = $type; } ?> <?php include 'header.php' ?> <?php include 'style.css' ?> <div id="pagecontent"> <h1>Upcoming Events</h1> <a class="neweventbutton" href="event_form.php">[new event]</a> </div> <dl> <dd><a href="events.php?event=*">all events</a></dd> </dl> <form method="get" action=""> <select name="agegroup"> <?php foreach ($agegroups as $agegroup): ?> <option value="<?php echo $agegroup['agegroupid'] ?>"> <?php echo htmlentities($agegroup['agegroup']) ?> </option> <?php endforeach ?> </select> <button>go</button> <select name="type"> <?php foreach ($types as $type): ?> <option value="<?php echo $type['typeid'] ?>"> <?php echo htmlentities($type['type']) ?> </option> <?php endforeach ?> </select> <button>go</button> </form> <?php include 'footer.php' ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted April 30, 2008 Share Posted April 30, 2008 Dynamically, Javascript With a submit button, use submits. Quote Link to comment Share on other sites More sharing options...
Aeglos Posted April 30, 2008 Share Posted April 30, 2008 Try to ve more verbose and specific about your problems, It's hard to guess if so little information is given. Looking at your code It looks like you want to display a list of $events picked according to the $type and $agegroup selected in the drop menus. I see your form is also using the GET attribute, so the variables are sent in the $_GET array to the action page defined in the form (which is empty)... In that action page you must define a query according to the $_GET['agegroup'] and $_GET['type'] variables you passed from the form. There's really not much to say if you don't provide more info, like the database structure, or the page that recieves the submited form, for example. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.