Jump to content

[SOLVED] Formatting POST data


jjacquay712

Recommended Posts

ok... here is my problem, i am submitting POST data to a php script, but for some reason its not getting all the data, all it returns is this: "  code  '. Here is the POST data:

name=john&code=function getXML() {
var xmlObject;
try {
	// Firefox, Opera 8.0+, Safari
  		xmlObject=new XMLHttpRequest();
  	} catch (e) {
  		// Internet Explorer
  		try {
    		xmlObject=new ActiveXObject("Msxml2.XMLHTTP");
    	} catch (e) {
    		try {
      			xmlObject=new ActiveXObject("Microsoft.XMLHTTP");
      		} catch (e) {
      			alert("Your browser does not support AJAX!");
      			return false;
    		}
    	}
	}
  	return xmlObject;
}
var xmlHttp = getXML();
function ajaxdelete(id) {
if (confirm("Are You Sure You Want To Delete This?")){
xmlHttp.onreadystatechange=function(){
	  	document.getElementById('i' + id).innerHTML = "";
}
xmlHttp.open("GET","index.php?deleteid=" + id,true);
xmlHttp.send(null);
}
}

function ajaxadd(name, code) {
xmlHttp.onreadystatechange=function(){
	if( xmlHttp.readyState == 4 ) {
  			document.getElementById('codearea').innerHTML = xmlHttp.responseText;
  		}

}
var locate = "name=" + name + "&code=" + code + '&button=Submit';
xmlHttp.open("post",'code.php',true);
xmlHttp.setRequestHeader( 
    'Content-Type', 
    'application/x-www-form-urlencoded' 
); 
xmlHttp.send(locate);

}

&button=Submit

 

(its random javascript for the data)

 

And here is the data type:

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

 

here is the URL http://johnj.gknu.com/codedump/ of the script

 

im thinking php isnt getting all the data because of the form data type. Any Ideas ?

Link to comment
https://forums.phpfreaks.com/topic/136354-solved-formatting-post-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.