Forum Moderators: coopster

Message Too Old, No Replies

PHP Strip Slashes In Contact Form

Help with stripping slashes in php script...

         

sujay

10:47 pm on Apr 17, 2005 (gmt 0)

10+ Year Member



Hello, I've been using the following code for email submissions on my website but I could never figure out how to get rid of the slashes when apostrophes are used, once the email is sent. I did a search on this forum and read a bit about the "stripslash" command, but I couldn't figure out how to implement it with the script that I'm using. Any help would be appreciated. Thanks.

<?php 
$email = "\nContact Form\n-----------------------------------------------------\nName:\t$iname\nE- Mail:\t$iemail\nSubject:\t$isubject\nMessage:\t$imessage\n\nIP:\t$REMOTE_ADDR\n$HTTP_HOST\n$HTTP_USER_AGENT\n\n";
$to = "email@server.com";
$subject = "Mailer- $isubject ";
$mailheaders = "From: $iname <$iemail> \n";
$mailheaders .= "Reply-To: $iemail\n\n";
mail($to, $subject, $email, $mailheaders);
?>

dreamcatcher

7:39 am on Apr 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World sujay. :)

This should do the trick:

mail($to, $subject, stripslashes($email), $mailheaders);

dc

sujay

4:02 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



Thanks very much. It works perfectly.