Pagorn Petchara Pagorn Petchara - 7 months ago 12
PHP Question

" or ' in PHP but it show \" or \' in browser

I fill

"
or
'
at Input Text firstname and press submit, but the browser shows
\"
or
\'
. I want it to show only
"
or
'
. How I can do this?

<?php
echo $_POST['firstname'];
?>
<html>
<body>
<form method="post">
<input type="text" name="firstname" placeholder="Firstname"/>
<input type="submit" name="ok" value="OK" />
</form>
</body>


Thanks.

Answer

stripslashes(); is very simple for this problem.