Jump to content

Recommended Posts

I am having a really strange problem. I generated this code from a product called PHP Form Wizard.

 

I have a form and everything in the form is working fine except one strange thing. When the user submits the form it sends an email to the form owner. In the email message that is sent everything is fine except that any time there is an apostraphe (') in a word, when the email is sent it puts three lines before the ' in the message.

 

For instance if the customer filled in "I don't know" the message the form owner gets says "I don\\\'t know"

 

It is weird and annoying my customer. Attached is the PHP code.  The form is at www.designfoundry.ie/contact.htm

 

Thank you very much in advance.

 

 

 

 

 

[attachment deleted by admin]

The code is applying addslashes() to all the form fields. Also, the php setting magic_quotes_gpc is probably on.

 

The addslashes() in the script should not be there at all (they don't escape all the special characters that can break a database query and your code is not using a database anyway.)

 

Unfortunately, your script cannot turn off magic_quotes_gpc. The preferred method to deal with magic_quotes_gpc is to turn them off globally in the master php.ini, a .htaccess file, or a local php.ini, because they have been eliminated in upcoming php6. If you cannot turn them off, your code will need to test if magic_quotes_gpc is on and apply stripslashes() to all the form fields. You cannot unconditionally apply stripslashes() because that would remove actual \ characters that someone entered if magic_quotes_gpc are not on.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.