Re: ereg
| From: | C.R. | Date: | Thu, 17 Apr 2003 16:37:44 +0000 |
| Subject: | Re: ereg | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144327@lists.php.net to get a copy of this message | ||
You'll have to explain this as the data is changing. If I don't use ereg at
all and enter an apostrophe in the user name - it shows up the way it should
(O'Tool). If I use ereg I then get O\'Tool.
So how should I do this then. I want the user to only be able to enter A-Z,
a-z, a - sign or an apostrophe.
Thanks
----- Original Message -----
From: "Jason Wong" <php-general@gremlins.biz>
To: <php-general@lists.php.net>
Sent: Thursday, April 17, 2003 10:51 AM
Subject: Re: [PHP] ereg
> On Thursday 17 April 2003 22:42, C.R. wrote:
> > This is what I have:
> >
> > if(!ereg("^[a-zA-Z[:space:]\\']*$", $formdata["lastname"])) {
> > $error = "Invalid Input";
> > }
> >
> > $formdata["lastname"] is a session variable and can't be changed as it
is
> > used throughout the site. I don't understand though why it it even being
> > changed as I thought ereg was just an expression.
>
> I'm not sure about the validity of your regex, but I can assure you that
> ereg() will NOT change your data. That 'problem' is caused by having
> magic_quotes_* on.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> I either want less decadence or more chance to participate in it.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>