Jump to content

[SOLVED] Retrieving POST Variables


Bendude14

Recommended Posts

Ok, i am using ajax to send some data via POST the problem is retrieving using php.

 

Here is the javascript

 

	    function validate() {     
		var content = document.getElementById("email").value;//value's to be send using send
            http.open("POST", url, true);
            http.onreadystatechange = handleHttpResponse;


		//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", content.length);
	http.setRequestHeader("Connection", "close");

            http.send(content);
		//alert(content);
        }

 

Here is the form where the info is been taken from

 

<input type="text" name="email" id="email" onblur="validate(this);" />Email<br />

 

 

And then i am trying to retrieve the info like this in php

 

$email = $_POST['email'];

 

But i do not recieve a value like this.

 

I think its the php because using firebug it shows that the value of email was actually sent via POST and i have also tried alerting the content var with javascript it outputs the value typed into the email text box

 

Thanks in advance for any help

 

 

Link to comment
https://forums.phpfreaks.com/topic/122164-solved-retrieving-post-variables/
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.