This is a discussion on Double drop down menu with PHP within the PHP General forums, part of the PHP Programming Forums category; Has anyone had any luck getting a double drop down menu to work with PHP? I can get the menu - ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Has anyone had any luck getting a double drop down menu to work with PHP?
I can get the menu - which is written in javascript to work, but I can't figure out how to pass the value of what the user selects to PHP. What I want to do is have a small online address book for the school district I work for. Users visiting our page would be able to select from searching by Last Name, Department or Building. What I wanted was if the user selects Department a menu opens up with all the departments listed, same for buildings. Here is the page with the javascript I am using. It simply redirects the user to a URL based on their selection. http://www.trans4mind.com/personal_d...Doublemenu.htm My only thought is to pass the selection through the URL, but then I have to turn on register_globals and that makes me nervous. Any thoughts/suggestions would be appreciated. Thanks, Robert Bowen Baldwin UFSD |
|
|||
|
On Tue, 15 Jul 2003 00:21:15 +0000, "Robert Bowen"
<bowenr@baldwin.k12.ny.us> wrote: <snip> > My only thought is to pass the selection through the URL, but then I > have to turn on register_globals and that makes me nervous. You do not have to turn register_globals on to do this, you just have to access the values through $_GET, $_POST or $_REQUEST depending on which method the javascript uses. If it appends the users selection to the url, use $_GET. To improve security, you can check that the values that are sent are what you are expecting - the safest way would be to give each item in the menus a number.. this would result in a url like this: http://some.domain.com/index.php?menu1=2&menu2=5 These values can be accessed in PHP by: $choice_1 = $_GET['menu1']; // should be 2 and $choice_2 = $_GET['menu2']; // should be 5 then, simply use something like: if(!is_numeric($choice_1){ echo "Selection must be a number"; return FALSE; } to check that you have been given a sensible input. You may also want to check that the number you receive is (a) an integer and (b) is within a certain range. Cheers, Sam. > > > Any thoughts/suggestions would be appreciated. > > > > Thanks, > > Robert Bowen > > Baldwin UFSD --- Posted via news://freenews.netfront.net Complaints to news@netfront.net |