hi there..
i have a form that POST's to a post.php.... on post.php it does this:
function safeinput($formvalue)
{
$formvalue = trim($formvalue);
$formvalue = strip_tags($formvalue);
$formvalue = htmlspecialchars($formvalue);
return $formvalue;
}
$name = safeinput($name);
$location = safeinput($location);
$message = safeinput($message);
echo $name;
echo $location;
echo $message;
now if i type into the input on the form page(that posts to post.php):
my name's Tom!
and i view it on the echo out, it will read "my name\'s tom"
what is what i want it todo...
but, if i take away the echo's and put in:
$insertquery = "INSERT INTO `messages` (`id` ,`name` ,`location` ,`date` ,`time` ,`message`) VALUES ( NULL , '$name', '$location', '$date', '$time', '$message')";
mysql_query($insertquery);
it inputs it into the database ok! but when viewed on PHPmyadmin, there is nolonger any slash's, and the string will appear as "my name's Tom!" during table browsing!
and if i output it to a page from the database, there still is no slashs!(and no, iv not used stripslash() )
iv turned magic quotes on, and it is working(because the echo's get slashed) so something is happening after/during there INSERT query.
can anyone shed some light on this for me?
PS. hello everyone! nothing like jumping straight in on my first post! lol😃
can anyone help? im puzzled!