coleby58 Posted March 3, 2009 Share Posted March 3, 2009 Hello everyone, sorry if and issue like this has already been solved I have looked for a while now. I am designing a page on my web site where a user types in something and clicks submit and then they go to a new page where there text is displayed here is my code on the page they type it: <div id="inputform"> <form method="post" action="inputform.php"> <table width="0%"> <tr> <td width="50%"> Type a Sentence: </td> <td width="50%"> <input width="200" type="text" name="userinput"> </td> </tr> <tr> <td> <center><input type="submit" value="submit" /></center> </td> </tr> and on the page it is displayed on (inputform.php) I have: <?php echo $_POST['userinput']; ?> this seems to work great except say they user types "I like bob's bike" the next page will display "I like bob\'s bike" For some reason it places "\" before any quotes used in the users input how can I fix this? Thanks! (sorry this was a long entry) Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/ Share on other sites More sharing options...
genericnumber1 Posted March 3, 2009 Share Posted March 3, 2009 There's a setting in your php.ini called magic_quotes_gpc, you'll need to disable that. edit, more info: http://us.php.net/manual/en/security.magicquotes.disabling.php Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/#findComment-775211 Share on other sites More sharing options...
coleby58 Posted March 3, 2009 Author Share Posted March 3, 2009 I finally found the right php.ini (apparently there are two in XAMPP) and set both of them to magic_quotes_gpc = Off and it didn't change anything Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/#findComment-775237 Share on other sites More sharing options...
genericnumber1 Posted March 3, 2009 Share Posted March 3, 2009 Did you restart your server? Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/#findComment-775238 Share on other sites More sharing options...
Floydian Posted March 3, 2009 Share Posted March 3, 2009 Can you run a php info script and confirm that the setting actually took? Alternatively, you can change this: <?php echo $_POST['userinput']; ?> to <?php echo stripslashes($_POST['userinput']); ?> You would only do that if magic quotes gpc is turned on. So confirm if it is on or off before using that code (or you can just use it lol, but best to confirm first ) Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/#findComment-775239 Share on other sites More sharing options...
genericnumber1 Posted March 3, 2009 Share Posted March 3, 2009 By php info script he means a script containing only <?php phpinfo(); ?> and yes, it would be helpful if your problem is not fixed by restarting your server. Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/#findComment-775243 Share on other sites More sharing options...
coleby58 Posted March 3, 2009 Author Share Posted March 3, 2009 Haha total noob mistake. I restarted my server and it works like a champ! Thanks! Link to comment https://forums.phpfreaks.com/topic/147686-solved-help-displaying-users-text-from-an-input-field/#findComment-775247 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.