dwest Posted March 12, 2007 Share Posted March 12, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/42298-solved-magic-quotes-problem-with-html-links-saved-in-database/ Share on other sites More sharing options...
fert Posted March 12, 2007 Share Posted March 12, 2007 http://us2.php.net/manual/en/function.stripslashes.php Quote Link to comment https://forums.phpfreaks.com/topic/42298-solved-magic-quotes-problem-with-html-links-saved-in-database/#findComment-205199 Share on other sites More sharing options...
dwest Posted March 12, 2007 Author Share Posted March 12, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/42298-solved-magic-quotes-problem-with-html-links-saved-in-database/#findComment-205209 Share on other sites More sharing options...
JasonLewis Posted March 12, 2007 Share Posted March 12, 2007 well if you want to display it normally, then strip it when you pull it from the database. Quote Link to comment https://forums.phpfreaks.com/topic/42298-solved-magic-quotes-problem-with-html-links-saved-in-database/#findComment-205211 Share on other sites More sharing options...
dwest Posted March 12, 2007 Author Share Posted March 12, 2007 Thanks ProjectFear. Now what about when it's emailed from the user form. Is there something I need to so in the email processing code to keep it formatted correctly? Quote Link to comment https://forums.phpfreaks.com/topic/42298-solved-magic-quotes-problem-with-html-links-saved-in-database/#findComment-205217 Share on other sites More sharing options...
dwest Posted March 12, 2007 Author Share Posted March 12, 2007 Never mind. I realize now after tinkering I just need to strip slashes each time I process the data. Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/42298-solved-magic-quotes-problem-with-html-links-saved-in-database/#findComment-205228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.