Jump to content

[SOLVED] Magic quotes problem with html links saved in database


Recommended Posts

Hi,

I think this is a magic quotes problem but I'm not certain.

 

On the backend of a site,

I have a form used to save some default content to a database.  The form has a textarea among other fields.  When a link is embedded in the textarea content like so,

<a href="http://thelink.com/link/" >The Link</a>

 

the link is saved in the database as,

<a href=\"http://thelink.com/link/\" >The Link</a>

I think this is due to magic quotes being on. (and no the host won't turn it off.)

 

On the frontend of the site,

The same default content is pulled into a user form which is used for emailing that content to others.  It can be edited by the user prior to mailing if desired.  For instance the user could add more links in the textarea as html.

 

I would like any links in the default content to be formatted correctly in the frontend user form when it is called.  I would also like those links, and any the user adds, to remain properly formatted when the email form is submitted.

 

What can I do to achieve this?

 

Thanks!

 

 

 

Thanks fert.  I'm aware of stripslashes but I'm not sure where to do the stripping.

 

Should I strip before saving to the database and be done with it there?

Or should I strip it as it is called from the database and leave the data storage alone?

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.