开发者

Special characters problem with database

I am trying to add special characters into database with JavaScript using encodeURIComponent but it works in localhost and in server adding ' an extra / is also added infront of ' .

开发者_开发技巧

How to prevent this?


This is what I have so far:

var qn_text = encodeURIComponent($('#question_text').val()); 

question_text is the field ID.

$.ajax({ type: "POST", url: "<?= site_url('admin/inputdata')?>", 
                       data: "qn_text ="+qn_text, 
                       success: function(msg) { } 
      });

admin is my controller and then to model. If I enter special character like +'&, all these characters are entered in local database correctly. But at server side the characters like ' entered but an extra / is appended infront of ' .


You need to disable magic_quotes on your server. See disabling magic quotes in the PHP manual.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜