simple bit of php - slashes being added

Joined
12 Feb 2006
Posts
17,643
Location
Surrey
i have a contact form which works fine except when the user adds an ' it adds slashes and looks messy on my end and then when replied to as the message is quoted in the email.

i tried stripslahes, htmlentities and urlencode but these cause problems when the user incorrectly fills out a field and then is shown the form again with the information that they filled out.

what would be the correct way to deal with the information that goes along this path.

user fills info and submits
method used is post
each bit of info is created into v****ble, e.g. $name = $_POST['name'];
check a few things to make sure email is a real address, contact number is number etc
if all is correct send email
if incorrect show form again and set value of input field to $name, $email etc
 
just calling stripslahes and nothing else doesn't work as the ' is making the input field end too early, e.g. <input type='text' value='it's a wonderful day'/>

all i see if the word it

same problem if i change to "
 
Back
Top Bottom