How to retrieve value from jquery combobox

Permalink
Guys, i know this is annoying, but i can't get the $_POST value from jquery combobox. yes i new to jquery. here the link comcobox i used
http://jqueryui.com/demos/autocomplete/#combobox...

i addes form, but still no value from POST
if($submit){
echo $_POST['combobox'];
echo $_POST['submit'] //result output :Submit Query
}
<form name="form1" method="post" id="form1" action="{action}">  
<label>Pilih Bunga</label>
<select id="combobox" name="combobox">
   <option value="">Select one...</option>
   <option id="50" value="4" > Cempaka </option>
   <option id="25" value="2" > Edelwheis </option>
   <option id="1000" value="1" > Mawar </option>
   <option id="10" value="3" > Melati </option>
   <option id="10" value="5" > Orchid </option>
   </select>
   <input type="submit" name="submit">
   </form>


this is the result being snippet :(
c'mon help me! just this one

man, it's just add - $('#form1').submit();, am i right?
really, jquery is scare me!

fastcrash
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
I can't tell you what is wrong, what you have looks superficially OK, so I suspect there is something else happening (or not happening) outside of what you have posted.

My favourite diagnostic code is:
echo '<pre>';
echo "********************\n";
echo htmlentities(print_r($_POST,true));
echo "\n====================";
echo '</pre>';

You could also use the Chrome or Firefox developer console to record network actions and look at the posts and responses.
fastcrash replied on at Permalink Reply
fastcrash
thanks john, i just copy from the source link as is. and i realize i dont' know how get the $_POST value. i think i mising this part one
$(function() {
   $( "#combobox" ).combobox();
   $( "#toggle" ).click(function() {
      $( "#combobox" ).toggle();
   });
   $('#form1').submit();  //i add this. its work
});
<?php echo $_POST['combobox']; ?>

i must make a presentation tomorrow in univeristy, and i'm not getin any sleep. whahahaaa..
JohntheFish replied on at Permalink Reply
JohntheFish
In php $_POST is a global, so you just use it.

On the web page, providing you have all the jQuery, clicking submit should simply send the value in the relevant part of the $_POST array. You shouldn't need any jQuery to submit the form (unless you are doing it by ajax, or are running the combobox with ajax).

Hence my note about looking at the network traffic in the developer console. That will tell you whether the form is actually being submitted fully and what is actually being posted to the server.