Reputation: 2160
I have the weirdest issue. I use an Ajax request to send data to a php page which saves details in a db for further use.
The comment after each echo
is the output that I get.
$name = $_POST['name'];
$surname = $_POST['surname'];
$message = $_POST['description'];
//$date = $_POST['date'];
$type = $_POST['request_type'];
echo file_get_contents("php://input"); // name=John&surname=Doe&description=Testing&request_type=note
date_default_timezone_set("Africa/Johannesburg");
$time = strtotime("now");
echo "NAME & SURNAME: " . $name . ' ' . $surname; // NAME & SURNAME:
Can anyone tell me WHY it outputs the right stuff when I echo file_get_contents("php://input");
but not anywhere else?
I'm at a loss. It does not make sense what-so-ever...
EDIT 1: In response to JBTRND.
To ensure you all that I make the right call, here is the AJAX request:
$.ajax({
type:'POST',
url:"local_code/form_accepted.php",
data:serialized,
success:function(response){
$('#request_type').attr('disabled');
$('#dialog').html(response);
$('#docSumbit').html(response);
}
});
serialized
is $('#support').serialize();
Upvotes: 0
Views: 138