通过表单上传链接到db时添加


being added when uploading a link to db via form

希望你能帮助我。在我的添加产品页面的一个字段,我有广告商链接到他的产品。它基本上是一个链接和一个按钮,将客户引导到该链接。

这是我在字段中上传的内容:

<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/>

,这是最终在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/>

我怎样才能阻止这种情况的发生?

如有任何帮助,不胜感激

因为这个字符串会自动转义
阅读这里,你可以提高你的工作与数据库。

使用stripslars和htmlspecialchars当输出:

print htmlspecialchars(stripslashes($text));