I have a site where the user currently selects an option (“event”) from a list menu which is populated from a database (See code below).
When a user clicks their selection in the box, I want some text links to appear which are the “locations” where that event is, which are stored in the same row of the database as the event is.
Alternatively instead of text links, it could populate a second list menu with the locations, I haven’t been able to get this to work for me yet though
I’ve been trying to get it to work through using onclick but have had no such luck.
Any tips/ ideas of what I should do?
The code so far is:
<?
require_once('dbconnect.php');
$sql="SELECT id, event FROM events";
$result=mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["id"];
$event=$row["event"];
$options.="<OPTION VALUE=\"$event\">".$event;'</OPTION>';
}
?>
and for the form:
<select name="event" id="event">
<?=$options?>
</select>
Any assistance would be appreciated, thanks very much!
You didn’t post any JS code, but if i understand you correctly, the events are presented as a dropdown list and once the user chooses an option you want to trigger an event.
In that case,
clickwon’t work, what you need to bind ischange.look here.