richardbeaumont Posted April 20, 2008 Share Posted April 20, 2008 I am a bit of a newbie. I have magic quotes switched on. I have a form that if it is not filled in properly is re-presented to the user with the fields populated via variables with what was previously submitted. This is working fine except there seems to be some strange escaping going on for a single quote ' in the text. In all the text input boxes if I enter, for example "He's" - after Submitting - with no validation going on it comes back as either "He/", or with stripslashes "He". However, I also have a text area field - and this behaves as I expect it to, so entering "He's" will either come back as "He/'s" or if I add stripslashes it comes back as "He's" Can anyone shed any light on this? Link to comment https://forums.phpfreaks.com/topic/102007-html-form-issue/ Share on other sites More sharing options...
darkfreaks Posted April 20, 2008 Share Posted April 20, 2008 try using stripslashes() Link to comment https://forums.phpfreaks.com/topic/102007-html-form-issue/#findComment-522052 Share on other sites More sharing options...
richardbeaumont Posted April 20, 2008 Author Share Posted April 20, 2008 i have tried stripslashes(). What ever I do - all of the string from the ' onwards is dropped in the text field. Without stripslashes it appends a \ - but still drops the rest of the string. But not in the textarea field. Link to comment https://forums.phpfreaks.com/topic/102007-html-form-issue/#findComment-522059 Share on other sites More sharing options...
darkfreaks Posted April 20, 2008 Share Posted April 20, 2008 what is your code please paste ??? Link to comment https://forums.phpfreaks.com/topic/102007-html-form-issue/#findComment-522063 Share on other sites More sharing options...
richardbeaumont Posted April 20, 2008 Author Share Posted April 20, 2008 These are two fields from the form: <label>Address 1: </label><input type='text'name='buyersaddress1' value='".$buyersaddress1."'/><br /> <label>Description of Requirements: <br /></label> <textarea name = 'buyersrequirements'cols='50' rows='8' >".$buyersrequirements."</textarea> *<br /> In both fields I input: He's This is the php: $buyersaddress1=$_POST['buyersaddress1']; $buyersrequirements=$_POST['buyersrequirements']; the form posts back to itself; then I get: Address 1: He\ Buyers Requirements: He\'s adding stripslashes to address 1: $buyersaddress1=stripslashes($_POST['buyersaddress1']); just gets me: Address 1: He Link to comment https://forums.phpfreaks.com/topic/102007-html-form-issue/#findComment-522077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.