Jump to content

Dealing with odd characters in input (#, %, &, +, -, etc)


steelerman99

Recommended Posts

Hello!

 

I recently ran into a bit of a problem and I'm not sure how to handle it.

 

I was putting in some test data the other day, and in one of the boxes I wrote "Apartment #234", and my input to my php page got all messed up (truncated) since it treated the # like a hash and didn't convert the # to a %23.  Likewise if I enter Steve & Mary, "Mary" is treated like i'm passing a variable named Mary.

 

How do you deal with special characters like #, %, &, etc. that a user inputs to a form and is sent via an ajax url?  Is there a better way to handle it than to do a string replace of every non-alphanumeric character imaginable?

 

Thanks!

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.