Jump to content

PHP, JS, and special characters


MichaelMackey

Recommended Posts

Hi, I'm fairly new to PHP, so far it's been fairly straight forward but I recently came across something that I wasn't sure how the best way to solve it would be.

 

I am having an issue where if someone enters a '#' into a textbox, when javascript retrieves it it screws up and causes further issues (I assume # is a reserved character in JS).  Anyway, I was wondering what the best way of dealing with this would be in PhP/JS?

 

Is there an option with JS or PHP to prevent it from ever getting this far through validation checks?  Or should I parse through the text before I submit and check for characters?  Any info is appreciated, thanks.

Link to comment
https://forums.phpfreaks.com/topic/107633-php-js-and-special-characters/
Share on other sites

Well I'm working with a previously set up system, there is currently a database street address with a "#" in it.  When I tested the edit function for this person it would fail everytime, after looking into it I found the javascript would see the # and at that point it ignored everything else so the rest of the data never made it through.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.