At the moment i am using this js function function saveData() { //store title and descr dataTitle = 'routeTitle=' + document.getElementById("dataTitle").value; dataDescr = document.getElementById("dataDescr").value; userID = 'userID='+ document.getElementById("userID").value; window.location.href = "save-data.php?dataTitle+"&"+userID+"&dataDescr="+dataDescr; } Code (markup): but i would like to use $_post in save-data.php. How should i rewrite function saveData()? regards
you need to encode that string as a url with something like var thePost = 'key=' + encodeURI( 'value' ) + '&whatever=' + encodeURI( 'wherever' ) ; however, I would use ajax to post the form and serialize() [ prototype ] to make the string instead of messing about, get prototype and look through the api docs on the site...... otherwise change $_POST to $_GET or $_REQUEST to have the script use post or get data
hmm, ok I am asking how to do $_POST in a javascript function. The $_GET/$_REQUEST way seems to work in firefox. I thought $_GET was restricted to 250 chars???/