Page 1 of 1

[SOLVED] how do i echo quotes and double quotes from the add

Posted: Sat Oct 23, 2004 8:01 am
by dwaynek
nigma | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

hi I'm using php to echo a variable retrieved from the address bar as a url but everytime i have a quote or double quote, when i echo the contents, there's always a \ (backslash) before the quote or doublequote. 

anyone know an easy fix to this?

to highlight what I'm trying to do, here's the bit of code that displays the variable.

Code: Select all

<p align="center"><font color="#FF00FF" size="+2"><strong>
<?php echo $msg; ?></strong></font></p>
http://www.test.com/realecard.php?msg=hello%22and%27

for some reason, this is coming out as

hello''and\"

rather than

hello'and"

any ideas?

nigma | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Sat Oct 23, 2004 8:26 am
by qads
[php_man]stripslashes[/php_man]

Code: Select all

<?php
$msg = stripslashes($_GET['msg']);
echo $msg;
?>

Posted: Sat Oct 23, 2004 8:31 am
by dwaynek
you are sooooo da man! thanks!