Re: preg_match array question

From: Date: Fri, 30 May 2003 17:13:31 +0000
Subject: Re: preg_match array question
Groups: php.general 
Request: Send a blank email to php-general+get-149579@lists.php.net to get a copy of this message
You could also have the form post as an array and this saves you the coding in PHP. Like this: <form> <input type=text name=num[]> <input type=text name=num[]> <input type=text name=num[]> </form> Chris
From: David Grant <david.grant@wiredmedia.co.uk> Reply-To: David Grant <david.grant@wiredmedia.co.uk> To: "Daniel J. Rychlik" <drychlik@tcsconsult.com> CC: php-general@lists.php.net Subject: Re: [PHP] preg_match array question Date: Fri, 30 May 2003 17:59:58 +0100 Daniel J. Rychlik wrote:
Hey, Im trying to use preg_match to validate numbers in multiple fields. I can check one field but Im having trouble checking multiple fields. preg_match ( '(foo)' , $_POST["num1"] ); <- That works fine. but I need to check multiple fields. I thought I would build an array with the POST data like this... $num = array ($_POST["num1"],
                    ($_POST["num2"]);  There are more than that...
and then use preg_match ('(foo)', $num) ; $num should point to my array, but that doesnt work. I get a warning message.. and it doesnt check the first num1 in the array. Im certain that Its my code, and I wanted to get some input on what Im doing wrong. -Dan
A quick search turned this up: http://www.php.net/manual/en/function.preg-grep.php -- David Grant Web Developer david.grant@wiredmedia.co.uk http://www.wiredmedia.co.uk Tel: 0117 930 4365, Fax: 0870 169 7625 Wired Media Ltd Registered Office: 43 Royal Park, Bristol, BS8 3AN Studio: Whittakers House, 32 - 34 Hotwell Road, Bristol, BS8 4UD Company registration number: 4016744 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ********************************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail

« previous php.general (#149579) next »