Post Submit Quotes Help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JustinMs66
Forum Contributor
Posts: 127
Joined: Sun Sep 03, 2006 4:18 pm

Post Submit Quotes Help!

Post by JustinMs66 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i have a simple form and i want it to be so that upon submission, it not only displays what the user submitted below, but it keeps what the user submitted inside the text fields. so far it has worked!

Code: Select all

<form action="" method="post">
<textarea rows="9" cols="45" name="text"><?php echo $_POST['text']; ?></textarea>
<input type="text" name="name" style="width:600px;" value="<?php echo $_POST['name']; ?>"/>
<br />
<input type="submit" name="submit" value="Submit"/>
</form>

Code: Select all

<?php
if (isset($_POST['submit'])) {
echo $_POST['name']."<br>";
echo $_POST['text'];
}
?>
again: so far this works.

but when i have quotes " or ' in the text, it replaces it with \" or \' how do i make it Not do that?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You have magic quotes on. You need to add code that
  1. detects that magic quotes are on
  2. removes the added slashes from submission information
get_magic_quotes_gpc(), stripslashes()
Post Reply