renj0806 Posted February 26, 2007 Share Posted February 26, 2007 Sorry for asking here, i was surfing the net but cant really find an answer. How can i retrieve values from a HTML ComboBox? <select name="myCombobox"> <option value="1">One</option> <option value="2">Two</option> </select> Sorry for this noobish question. Link to comment https://forums.phpfreaks.com/topic/40233-combobox/ Share on other sites More sharing options...
Orio Posted February 26, 2007 Share Posted February 26, 2007 Depends on the form's method. If you have this line before the dropdown: <form action ..... method="POST"> The method is post. You use the $_POST array. If you have this line: <form action ..... method="GET"> The method is get. You use the $_GET array. Now, as you can see, the dropdown's name is myCombobox. So if you are using the $_GET array, you'll use $_GET['myCombobox']. And if you are using the $_POST array, you'll use $_POST['myCombobox']. My suggestion- read some tutorials about PHP and forms. (Links). Orio. Link to comment https://forums.phpfreaks.com/topic/40233-combobox/#findComment-194649 Share on other sites More sharing options...
boo_lolly Posted February 26, 2007 Share Posted February 26, 2007 echo $_POST['myComboBox']; Link to comment https://forums.phpfreaks.com/topic/40233-combobox/#findComment-194650 Share on other sites More sharing options...
renj0806 Posted February 26, 2007 Author Share Posted February 26, 2007 aryt, I'll revise my question since I am using AJAX. Im doing this without a form and ive been successful retrieving values from textfields. This is how i do it using absolute targetting. Textfield <input type="text" id="textfield" value="one" /> I retrieve this by: id('textfield')/@value but in <select id="myCombobox"> doing id('myCombobox')/@value just wont work for me. Link to comment https://forums.phpfreaks.com/topic/40233-combobox/#findComment-194653 Share on other sites More sharing options...
Orio Posted February 26, 2007 Share Posted February 26, 2007 I think you should go to the ajax forum with that... Orio. Link to comment https://forums.phpfreaks.com/topic/40233-combobox/#findComment-194658 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.