Jump to content

Dropdown box


01hanstu

Recommended Posts

Hi, i have a List/Menu object on my php form. What is does at the minute is the user selects the room that they want to view, then they have to clock go. I need this to happen automatically, can this be done?

 

My Current code       

<form name="roomform" method="post" action="bookingindex.php?week=<? print $mondaythisinstance ?>">

          <select name="selectroom" class="formnames">

              <option value=" <?PHP print $room ?>" selected>Selected: <?PHP print $room ?></option>

<option value="">- - - - - - - - - - -</option>

  <? while ($loop < $getroomcount)

            {

print"<option value=\"".mysql_result($getroomresults,$loop,"roomname")."\">".mysql_result($getroomresults,$loop,"roomname")."</option>";

            $loop ++;

}

?>

          </select>

          <input name="Submit" type="submit" class="formnames" value="Go">

          </div>

      </form>

 

Then once go is clicked it  shows the timetable for the room

Hope you can help

Stuart

Link to comment
https://forums.phpfreaks.com/topic/154475-dropdown-box/
Share on other sites

Do you mean when they select the room, you want the data to display instantly? Or to just submit the form without having to press submit?

 

Solution to the latter is to just add:

 

onchange="document.form_name.submit();"

 

... to your select element.

 

Adam!

Link to comment
https://forums.phpfreaks.com/topic/154475-dropdown-box/#findComment-812225
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.