NZ_Kiwis
05-24-2007, 07:01 AM
I have a form, and when a user selects something from a list box my screen may refresh... it's not a submit it's refreshing... how can i get the data chosen from the list box back???
|
Click to See Complete Forum and Search --> : Getting info from refresh etc NZ_Kiwis 05-24-2007, 07:01 AM I have a form, and when a user selects something from a list box my screen may refresh... it's not a submit it's refreshing... how can i get the data chosen from the list box back??? Kudose 05-24-2007, 07:54 AM Using javascript. document.getElementById('id').value NZ_Kiwis 05-24-2007, 08:06 PM <p><select size="1" name="country" onchange="window.location.href='accommodationfinder.php'"> <option value="AU">Australia</option> <option value="US">USA</option> <option value="HK">Hong Kong</option> </select> Country </p> <SCRIPT> function fnGetId(){ // Returns the first DIV element in the collection. var type = document.getElementByID("country"); alert(type); } </SCRIPT> <p><select size="1" name="city" onfocus="fnGetId()"> This does not work?? Kudose 05-24-2007, 08:31 PM var type = document.getElementsByName("country")[0].value; alert(type); NZ_Kiwis 05-24-2007, 08:40 PM <p><select size="1" name="country" onchange="fnGetId()"> <option value="AU">Australia</option> <option value="US">USA</option> <option value="HK">Hong Kong</option> </select> Country </p> <SCRIPT> function fnGetId(){ // Returns the first DIV element in the collection. var type = document.getElementsByName("country")[0].value; alert(type); } </SCRIPT> <p><select size="1" name="city"> This works, how can i change type into a PHP variable???? Kudose 05-25-2007, 12:37 AM There isn't an easy way. You'll have to either post the data or add the data to the URL on the refresh and have PHP look at $_GET PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved. |