• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Special characters issue


I've got a form that I need to pass data through in order to query my database. This form needs to be able to query such things as "qwe#rty," however, if I do this, only "qwe" is being passed through, and everything else is being ignored. 

I don't believe my form is the problem, as it has a redirect, and it redirects correctly (xxx/qwe#rty). But when I attempt to echo my variable that passed 'qwe#rty', it'll only echo 'qwe' and ignore the special character, and anything else after, querying the database with only 'qwe.'

I've tried using $this->uri->segment, and had the same problem. I've also tried urlencode/urldecode, and ended up with the same problem, with % and anything after being ignored.

Thanks in advance if anyone can help.

This works great for me:
PHP Code:

(11-25-2019, 01:46 PM)jreklund Wrote: This works great for me:
PHP Code:

This is still only returning 'string(3) "qwe"' for me.

Have you tried a clean version of Codeigniter? As it will be hard to debug if you have done customization.

What version PHP are you using? Have you tried to update to the latest one?

How are you passing the form data?

Once upon a time, for simple database queries based on only one value, I would append the variable to an Ajax $_GET URL.
Thus /controller/method/$variable would be /controller/method/qwe#rty.

This caused problems since anything after the '#' is not sent to the server, it is only used by the browser to link to DOM elements on that same URL.  Sending the Ajax request via $_POST solved it.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.