Link to home
Start Free TrialLog in
Avatar of brad0525
brad0525

asked on

passing multiple values using xmlhttp.send

I am using the script below to pass values from a form to a php page.  The first xmlhttp.send always returns a value, the second one is always blank. I am trying to figure out how to send multiple values using xmlhttp.send
if(xmlhttp) { 
  	var txtname = document.getElementById("txtname");
	var number  = document.getElementById("number");
    xmlhttp.open("POST","testing.php",true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleServerResponse;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send("txtname=" + txtname.value); //Posting txtname to PHP File
	xmlhttp.send("number=" + number.value); //Posting number to PHP File
  }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brad0525
brad0525

ASKER

Thanks works perfect
Have you tried something like this:

xmlHttp.send("txtname=txtname.value&number=number.value");
You're welcome! Thanks for the points!