Forum Moderators: coopster
I don't understand why form results still have slashes in them after using stripslashes (comments: This is and isn\'t a test of a form. \"What do you think or don\'t think?\"
)
What's wrong with the code? I've tried various things and searched forums and google, but I can't determine what I need to do.
<?php
$PageTitle = "Comments";
$name = stripslashes(trim($name));
$email = stripslashes(trim($email));
$comments = stripslashes(trim($comments)); // Tried with and without this line
foreach($HTTP_POST_VARS as $key => $value)
{
if ($value!="") {
$message .= $key . ": " . $value;
$message = stripslashes(trim($message));
$message .= "\n";
}
}
mail("me@domain.com","Comment Submission","$message","From: $name <$email>");
header ("Location: /fileupload/confirm_2.php");?>
This has plagued me for a long time...I'm hoping some php guru will share some insight and wisdom.
Thanks,
ksp
foreach($HTTP_POST_VARS as $key => $value)
{
if ($value!="") {
$message .= $key . ": " . $value;
$message = stripslashes(trim($message));
$message .= "\n";
}
}
$message = '';
foreach($HTTP_POST_VARS as $key => $value) {
if ($value!="") $message .= $key . ": " . stripslashes(trim($value)) . "\n";
}