I'm getting closer. I have a form that want to submit to a PHP file for processing and updating a MySQL db and then update a div. I can send the data to my PHP file and see it but not sure how to access it so it is useful.
from my JS
var str = $("form").serialize();
xmlhttp.open("GET","concessions_write.php?"+str,true);
xmlhttp.send();
sends this to my PHP file
concessions_write.php?btn%5B%5D=button01&itm%5B%5D=Hot+Dog&prc%5B%5D=1.00&id%5B%5D=1&btn%5B%5D=button02&itm%5B%5D=Popcorn&prc%5B%5D=1.00&id%5B%5D=3&btn%5B%5D=button03&itm%5B%5D=Combo&prc%5B%5D=3.50&id%5B%5D=2&btn%5B%5D=button04&itm%5B%5D=Nabs&prc%5B%5D=0.50&id%5B%5D=4&name=&message=
in my PHP file a
print_r($_GET);
gives
Array (
[btn] => Array (
[0] => button01
[1] => button02
[2] => button03
[3] => button04
)
[itm] => Array (
[0] => Hot Dog
[1] => Popcorn
[2] => Combo
[3] => Nabs
)
[prc] => Array (
[0] => 1.00
[1] => 1.00
[2] => 3.50
[3] => 0.50
)
[id] => Array (
[0] => 1
[1] => 3
[2] => 2
[3] => 4
)
[name] =>
[message] =>
)
This is the info I need. Each entry has 4 parts - btn, itm, prc and id and I currently have 4 entries. Just not sure how to break it down to usable arrays so I can write the data back to the db.
Look at parse_str but can't seem to get it to work.
Ideas? Also any idea where name and message might be coming from? No form elements with this.
XMLHttpRequestmanually? The jQuery$.get()function would make this simpler.