Jump to content

Ensure strings only contain desired characters **solved**


Recommended Posts

Essentially i am trying to check my forms content to ensure that nothing is in the wrong places - eg, telephone numbers are actual numbers, emails are email address etc.

I am having trouble with other fields where i just want to have a-zA-Z0-9... and spaces.
Does anyone know how I allow spaces? I have a text area where strings of non solid text will be entered (ie, strings containing spaces between words!) - but checking them as a-zA-Z means that spaces = error.

Seeing as I am also using mssql as my database, I am concerned about sql injection, and so am wondering how i can "escape" characters that may be troublesome like ', " etc etc. I know addslashes works for mysql - but i am not sure that this escapes characters such as this in mssql - does anyone know?

Many thanks for any suggestions/pointers/help.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.