...

View Full Version : Why won't this work?



cyphix
05-21-2004, 06:02 PM
elseif ($fmtext == /[^0-9]/ or $fmcheckbox == /[^0-9]/) {


??

Thanks!

sad69
05-21-2004, 08:44 PM
elseif ($fmtext == /[^0-9]/ or $fmcheckbox == /[^0-9]/) {


??

Thanks!

else if are two words, not one.

Sadiq.

raf
05-21-2004, 08:46 PM
it doesn't work because you are trying to compaire against the part of a regex.

aren't rou trying to see if the values are numeric? then it's


elseif (is_numeric($fmtext) or is_numeric($fmcheckbox)) {


<edit> elseif is just fine </edit>

cyphix
05-21-2004, 10:04 PM
Yeah.. the actual elseif statement works fine like that, it'd the regex parts I was having trouble with.

If I use "is_numeric" doesn't that allow decimals tho? :confused:

raf
05-21-2004, 11:19 PM
if you only want integers, you can use is_int

cyphix
05-21-2004, 11:44 PM
Ok, thnaks!

dswimboy
05-21-2004, 11:55 PM
preg_match is the (prefferrrd by me) regular expression engine in php. here are the docs:
http://www.php.net/manual/en/ref.pcre.php
http://www.php.net/manual/en/ref.regex.php

cyphix
05-22-2004, 12:15 AM
Cheers dswimboy!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum