stripslashes function in PHP? Doesn't seem to work...
I've been trying to get the stripslashes() function in a PHP script to work but I'm not having any luck. It seems like a very straightforward function but I'm still ending up with slashes in my comment/text area data. Can anyone help? I have some PHP books but they barely touch on the functionality. (I'm new to PHP). Thanks! (BTW... I removed the various attempts at calling the stripslashes() function). The field I'm trying to remove the slashes from is the 'comment' variable.
Here is my short php script:
<?php // Script 1.0 - contactlist.php
if (isset($_POST['submit']) && !empty($_POST['submit'])) // Test if submit button named submit was clicked and not empty
{
if (!empty($_POST['first']) && !empty($_POST['last']) && !empty($_POST['email']) && !empty($_POST['phone']) && !empty($_POST['comment'])) {
$body = "First Name: {$_POST['first']}\nLast Name: {$_POST['last']}\nEmail Address: {$_POST['email']}\nContact Phone Number: {$_POST['phone']}\nContact Preference: {$_POST['contactvia']}\n\nBest Time To Contact: {$_POST['timepref']}\n\nComments:\n {$_POST['comment']}";
$body = wordwrap($body, 70);
mail('someone@somewhere.net', 'NEW Customer Inquiry Submission',$body, "From: {$_POST['email']}");
header('Location: index.html'); //Redirect to new url if form submitted
}
}
?>
