I am having problems with double quotes inside a post variable. The
code below illustrates this. If the user enters non-quoted text then
the code works OK. If "Hello" is entered then I get $some_text equal
to \"Hello\". What I want is the actual text that the user entered
and not the processed version.
I am new to php so please be gentle with me.
Thanks in advance,
Mark
<?php
if (isset($_POST['some_text']))
$some_text = $_POST['some_text'];
else
$some_text = "";
?>
<html><body>
<form method="POST" action="test.ph p">
<p>
<?php echo("Old text: " . htmlentities($s ome_text). "<br>"); ?>
Enter text: <input name="some_text " size="20"><br>
<input type="submit" value="Submit" name="Submit">
</p>
</form>
</body></html>
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)
Mark Stevens (mark at thepcsite fullstop co fullstop uk)
code below illustrates this. If the user enters non-quoted text then
the code works OK. If "Hello" is entered then I get $some_text equal
to \"Hello\". What I want is the actual text that the user entered
and not the processed version.
I am new to php so please be gentle with me.
Thanks in advance,
Mark
<?php
if (isset($_POST['some_text']))
$some_text = $_POST['some_text'];
else
$some_text = "";
?>
<html><body>
<form method="POST" action="test.ph p">
<p>
<?php echo("Old text: " . htmlentities($s ome_text). "<br>"); ?>
Enter text: <input name="some_text " size="20"><br>
<input type="submit" value="Submit" name="Submit">
</p>
</form>
</body></html>
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)
Mark Stevens (mark at thepcsite fullstop co fullstop uk)
Comment