echo returns "\" instead of "'"
Moderator: General Moderators
echo returns "\" instead of "'"
I make use of a contact form on my (future) site, and when the user hits submit, I use echo to output the message sent to my email, but, whenever there's a word with a "'" in it (can't, don't etc..) php echoes it as a "\", so instead it looks like this: don\t, can\t etc..
how do I work around that?
-----------------------------------
<?php $to = "you@me.not";
$message = $message;
mail ($to, $subject, $message);
echo("<strong>THANK YOU!</strong>
<br>The following message was sent:
<br><br><strong>to:</strong><br>
<a href=\"http://www.notyet.no\" class=\"nonbold\">notyet.no</a><br><br>
<strong>message:</strong><br>
$message\n");?>
-----------------------------------
I'm not a stable coder, so don't make fun of my php-code :)
Any help would be greatly appreciated!
Thank!
Best retards,
r3curse
how do I work around that?
-----------------------------------
<?php $to = "you@me.not";
$message = $message;
mail ($to, $subject, $message);
echo("<strong>THANK YOU!</strong>
<br>The following message was sent:
<br><br><strong>to:</strong><br>
<a href=\"http://www.notyet.no\" class=\"nonbold\">notyet.no</a><br><br>
<strong>message:</strong><br>
$message\n");?>
-----------------------------------
I'm not a stable coder, so don't make fun of my php-code :)
Any help would be greatly appreciated!
Thank!
Best retards,
r3curse
Code: Select all
<?php
$to = "you@me.not";
$message = $_POST['message']; // i'm sure it came from a form
$message = str_replace("", "'", $message);
mail($to, $subject, $message);
echo <<< HERE
<strong>
THANK YOU!
</strong>
<br />
The following message was sent:
<br /><br />
<strong>
to:
</strong>
<br />
<a href="http://www.notyet.no" class="nonbold">
notyet.no
</a>
<br /><br />
<strong>
message:
</strong>
<br />
$message
HERE;
?>-Nay
uh, like this I guess:
:)
Code: Select all
$message = stripslashes($message);