PHP - post data ends when '&' is in data.
- by Phil Jackson
Hi all, im posting data using jquery/ajax and PHP at the backend. Problem being, when I input something like 'Jack & Jill went up the hill' im only recieving 'Jack' when it gets to the backend.
I have thrown an error at the frontend before that data is sent which alerts 'Jack & Jill went up the hill'.
When I put die(print_r($_POST)); at the very top of my index page im only getting [key] => Jack
how can I be loosing the data?
I thought It may have been my filter;
<?php
function filter( $data ) {
$data = trim( htmlentities( strip_tags( mb_convert_encoding( $data, 'HTML-ENTITIES', "UTF-8") ) ) );
if ( get_magic_quotes_gpc() ) {
$data = stripslashes( $data );
}
//$data = mysql_real_escape_string( $data );
return $data;
}
echo "<xmp>" . filter("you & me") . "</xmp>";
?>
but that returns fine in the test above you & me which is in place after I added die(print_r($_POST));.
Can anyone think of how and why this is happening?
Any help much appreciated. Regards, Phil.