jonmkim Posted July 12, 2008 Share Posted July 12, 2008 I'm trying to create a form that will let users select a list of devices from a dropdown menu and then print the selection back on the page. After selecting and submitting that one device, the user should then have the option to select another device and add it to their growing list of added devices. For example, someone should be able to select "Battery," hit "Add device" and then be brought back to the page. Now, above the dropdown menu it will read, "Battery." They should be able to continue adding devices which will all be listed above the dropdown menu. Here is my code: <form name="new_reservation" action="<?=$PHP_SELF?>" method="GET"> <b>Make a New Reservation</b> <li style="list-style-type:none;"> <?php if (isset($_GET)) { // echo "Data has been posted."; $added = $_GET['add_device']; echo $added; echo "</li><li style='list-style-type:none;'>"; } ?> <select name="add_device"> <option value="">Select a device</option> <option value="battery">Battery</option> <option value="card reader">Card Reader</option> <option value="ethernet cable">Ethernet Cable</option> <option value="extension cord">Extension Cord</option> <option value="Firewire cable">Firewire Cable</option> <option value="keyboard">Keyboard</option> <option value="laptop">Laptop</option> <option value="mouse">Mouse</option> <option value="power strip">Power Strip</option> <option value="projector">Projector</option> <option value="speakers">Speakers</option> <option value="USB (mini size)">USB (Mini Size)</option> <option value="USB (standard size)">USB (Standard Size)</option> <option value="VGA Video Cable">Video Cable - VGA</option> <option value="VGA to DVI Video Cable">Video Cable - VGA to DVI</option> <option value="VGA to Mini DVI">Video Cable - VGA to Mini DVI</option> <option value="wacom tablet">Wacom Tablet</option> </select> <input name="submit" type="submit" value="+ Add device"></input> <input type="hidden" value="<?=$added?>"> </li> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 12, 2008 Share Posted July 12, 2008 Wouldn't it be much simpler (for both you and for the user) to add a multiple parameter? http://www.w3schools.com/TAGS/tag_select.asp Quote Link to comment Share on other sites More sharing options...
jonmkim Posted July 12, 2008 Author Share Posted July 12, 2008 Wouldn't it be much simpler (for both you and for the user) to add a multiple parameter? http://www.w3schools.com/TAGS/tag_select.asp I would prefer to not do it that way because it would clutter the page. In addition, we're doing this for people who still call in to make reservations because they can hardly understand their computer. Ctrl + click probably won't sit well with them. I'm speculating whether I should just create a temp table in the database to store the devices that the user adds, but I think that'd be even more complicated. No? Quote Link to comment Share on other sites More sharing options...
teynon Posted July 12, 2008 Share Posted July 12, 2008 You should look into using javascript. The way you mentioned is slightly ineffective. http://www.mattkruse.com/javascript/selectbox/ has some good javascript examples Quote Link to comment Share on other sites More sharing options...
jonmkim Posted July 12, 2008 Author Share Posted July 12, 2008 You should look into using javascript. The way you mentioned is slightly ineffective. http://www.mattkruse.com/javascript/selectbox/ has some good javascript examples Thanks teynon. I'll give it a shot and see what happens. Quote Link to comment Share on other sites More sharing options...
bothwell Posted July 12, 2008 Share Posted July 12, 2008 http://www.mattkruse.com/javascript/selectbox/ has some good javascript examples Man, I am so glad you posted that link. This is a great site! 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.