Problem With PHP Contact Form 
Author Message
 Problem With PHP Contact Form

The contact form on my site works, but it escapes all ' and " characters by
adding a / before them. It makes the message sort of hard to read.

I was just wondering if anyone knows a way around this?

My code for the contact form is as follows:

<?php

$msg = "Sender Name:\t$_POST[name]\n";
$msg .= "Sender E-Mail:\t$_POST[email]\n";
$msg .= "Message:\t$_POST[message]\n\n";


$subject = "My Website Feedback";

$mailheaders = "From: My Web Site <> \n";
$mailheaders .= "Reply-To: $_POST[email]";

mail($recipient, $subject, $msg, $mailheaders);

header( "Location: thanks.php" );

?>

TIA if anyone is able to help.



Mon, 20 Jun 2005 23:31:00 GMT  
 Problem With PHP Contact Form
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In a fit of e{*filter*}ment on Thu, 2 Jan 2003 10:31:00 -0500, "Mike"

Quote:
> The contact form on my site works, but it escapes all ' and "
> characters by adding a / before them. It makes the message sort of
> hard to read.

> I was just wondering if anyone knows a way around this?

> My code for the contact form is as follows:

> <?php

> $msg = "Sender Name:\t$_POST[name]\n";
> $msg .= "Sender E-Mail:\t$_POST[email]\n";
> $msg .= "Message:\t$_POST[message]\n\n";


> $subject = "My Website Feedback";

> $mailheaders = "From: My Web Site <> \n";
> $mailheaders .= "Reply-To: $_POST[email]";

> mail($recipient, $subject, $msg, $mailheaders);

> header( "Location: thanks.php" );

> ?>

> TIA if anyone is able to help.

I wrote a small function to remove such items:

function strip_all($string) {
  $string = strip_tags($string);
  $string = stripslashes($string);
  return $string;

Quote:
}

$msg = strip_all($msg);

The above will remove HTML and escape slashes from forms.

HTH.

Regards,

  Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.3

iQA/AwUBPhRkpWfqtj251CDhEQK08QCgtkrvnU6Pc/oMSgceZ6M+vdK3cRwAoMAk
VKWeV+5RzvmdXKywoOSp0b6V
=9eZU
-----END PGP SIGNATURE-----

--
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.



Tue, 21 Jun 2005 00:11:24 GMT  
 Problem With PHP Contact Form

Quote:

> The contact form on my site works, but it escapes all ' and " characters
> by adding a / before them. It makes the message sort of hard to read.

www.php.net/stripslashes

--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.



Tue, 21 Jun 2005 00:11:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. newbie with a php validation form mail script problem

2. form posting to php "problem"

3. PHP form problem, help needed

4. TCL/PHP problem involving a PHP function that has to utilize a TCL proc

5. Help with select option in form - new to PHP

6. Value entered in form is not processed by PHP script

7. Secure PHP form

8. form and php prob

9. Getting a form element into PHP =before= it is submitted

10. PHP and forms, checked or not checkbox

11. Simple Question - Run .php form an html directory

12. Emailing Forms with PHP -- Help!!!

 

 
Powered by phpBB® Forum Software