Forum Moderators: open
this is the onclick function
function process()
{
// only continue if xmlHttp isn't void
if (xmlHttp)
{
// try to connect to the server
try
{
var firstNumber = document.getElementById("firstNumber").value;
var secondNumber = document.getElementById("secondNumber").value;
// ($_POST)
var params = "firstNumber=" + firstNumber + "&secondNumber=" + secondNumber;
xmlHttp.open("POST", "compute.php", true);
xmlHttp.onreadystatechange = handleRequestStateChange;
xmlHttp.send(params);
}
// display the error in case of failure
catch (e)
{
alert("Can't connect to server:\n" + e.toString());
}
}
}
and this will be the compute.php
header('Content-Type: text/xml');
$firstNumber = $_POST['firstNumber'];
$secondNumber = $_POST['secondNumber'];
.....
my problem
I tried the GET approach and I make it to work so now Im trying the POST approach but
$firstNumber and $secondNumber is not getting any value. can't figure out what went wrong. please help
XMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");