This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
PHP and Regular Expression question: Apostrophes not accepted on my form although I include them

Hi, I'm hoping someone out there is familiar with regular expressions and can help me.

I've created a form from scratch, at www.cyberwavedesign.com/forms/request-quote-web-design.php. When you submit the form there's a validation page that displays any errors you've made, or if there are no errors it displays the form so you can confirm that all the info there is what you really want to send. The final page is a thank-you page that shows after you've finished correcting or confirming your info.

Everything seems to work fine, except that although I've included the apostrophe character in the preg_match string, the form still won't accept it. On my validation page I've tried several preg_match strings, with the apostrophe in different places, escaped and not escaped, and nothing seems to work. My preg_match strings look like this:

- for the First Name field I currently have:
preg_match("/^[-A-Za-z'. ]{2,20}$/",$fname)
- for the LastName field I've tried:
preg_match("/^[A-Z'a-z-. ]{2,20}$/",$lname)
- for the Company Name field I've tried:
preg_match("/^[A-Za-z0-9-@#$%&',. ]{0,40}$/",$coname)
and so on. In all of these I've put a backslash before the period to escape it, but the backslash won't show up here.

I think I've tried about every way I can find, and I'm at my wit's end. So I'd really appreciate any help and feedback you can give me. Thanks in advance, and take care.

P.S.: I'm almost totally blind so I use a screen reader to access the computer, and the visual verification code is a real pain for me. If any moderators are listening, can you please include an audio capture version of the code, or maybe consider having a simple test question for people to fill in an answer, e.g. "What is 2+2?" etc. Thanks.

Browser: IE7

OS: Windows XP

Re: PHP and Regular Expression question: Apostrophes not accepted on my form although I include them

Hi, I figured it out! I went into my PHP config file and turned off Magic Quotes. That worked and now my form won't tick off my visitors! After that I had problems with inserting the data into my MySql database, but I figured out how to fix that too. Thank God!

Browser: IE7

OS: Windows XP