Welcome Guest, Not a member yet? Register   Sign In
Error writing to database with % char from a post variable.


I'm working ona project that creates CMS like pages.

But when the data includes a % char codeigniter writes it to database buggy.

for example.

<form name="myform" action="cms/save" method="post">
<textarea name="mytext">here is some discount % 50 off</textarea>
<input type="submit" value="Send">

(Here I can't write the orginal text because forum can't save as required too. Orginal text must be without space between % and 50 )

cms.php :


function save(){

$this->db->query("update mycms set mytext=?",$this->input->post('mytext'));



Query works great but it saves the text to database like this : "here is some discount P off"
% char and the numbers are changing. I don't know why this occurs.

The same error on the forum too, I have noticed that while I was previewing my post. You can check it too. Try to reply by writing "% 50" without space between % and 50.

Do you have an idea about this?

Theme © iAndrew 2016 - Forum software by © MyBB