You are here: Re: [PHP] eregi problem « PHP « IT news, forums, messages
Re: [PHP] eregi problem

Posted by BAO RuiXian on 10/11/06 11:12

emre@vt.com.tr wrote:

>I m trying to check $GP[sifre] variable, $GP[sifre] must consist of alpha
>numeric chars only. here, how I check the variable:
>
>
>
Try this:

if(eregi("^[a-zA-Z0-9]+$",$GP[sifre]))

The above say that between the beginning of the string "^" and the end
of the string "$", there are only alpha-numeric characters but at least
one. Note, your following code has syntax error.

Best

Bao



>if((eregi("[^a-zA-Z0-9]",$GP[sifre])
> echo 'true';
>else
> echo 'false';
>
>It works if variable starts with alphabetic chars only.
>for example this returns 'ok'
> $GP[sifre]='blabla234243';
>but this does not work: (if variable starts with numeric chars)
> $GP[sifre]='3243242blabla';
>
>second one returns false, couldnt figure out the problem here. any help ?
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация