Peter Mourra
Peter Mourra

Reputation: 11

\ being added when uploading a link to db via form

Hope you can help me with this. On one of the fields in my add product page, I have the advertisers link to his product. It basically is a link and a button direct the customer to that link.

This is what I uploaded in the field:

<a target='_blank' href='http://click.linksynergy.com/fs-bin/click?id=3qM*AG8K6Qo&offerid=146141.3706263&type=2&subid=0'><img border="0" src='style/buynowbutton.png' width='138' height='20'><a/>

and this is what ends up in the db:

<a target=\'_blank\' href=\'http://click.linksynergy.com/fs-bin/click?id=3qM*AG8K6Qo&offerid=146141.3706263&type=2&subid=0\'><img border=\"0\" src=\'style/buynowbutton.png\' width=\'138\' height=\'20\'><a/>

How can I stop this from happening?

Any help would be greatly appreciated

Upvotes: 0

Views: 34

Answers (1)

user680786
user680786

Reputation:

Because this strings automatically escaped
Read here, how you can improve your work with DB.

Use stripslashes and htmlspecialchars when output:

print htmlspecialchars(stripslashes($text));

Upvotes: 2

Related Questions