|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
desperatly need help
hello. I'm trying for many days now to make a dropdown that has an onchange event.
I have the following drpdown : PHP Code:
OK. When I select a country, the form is submited, the page reloaded and and the selected option is the first in the list. I want that after the form is submited and the page reloaded, the selected country to be the one I choosed before. Pls help Thx a lot |
|
#2
|
||||
|
||||
|
Ok, code is mostly ok, but you made a few mistakes, which probably comeup because you're assuming an old server-config.
Your code assumes register_globals is on, in other words, you access all server and POST variables by their direct name, instead of fetching them from their respective arrays, however, few servers allow that nowadays, as it is a serious security flaw, so you should instead get them from the global arrays. The variables you try to use are: $PHP_SELF $chooseCountry they should be: $_SERVER['PHP_SELF'] (you also forgot to echo this one) $_POST['chooseCountry'] next, there are a few minor flaws in your HTML. to make an <option> selected, the proper code is: <option value="value" selected="selected"> instead of <option value="value selected"> Finally, unless you've defined a javascript function submitpage() yourself, the proper code would be submit(this), to submit the form on the onchange. The correct code would then read (tested this): PHP Code:
Hope this helps. PS: the correct plural of country is countries, not countryes ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > desperatly need help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|