Jump to content

html form issue


richardbeaumont

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.