Looping through variables

From: Date: Mon, 23 Apr 2001 19:40:43 +0000
Subject: Looping through variables
Groups: php.general 
Request: Send a blank email to php-general+get-49918@lists.php.net to get a copy of this message
I have a bunch of variables (through a POST form) that I need to loop through and check for content. Right now, each one is being evaluated separately: if ($var1 == '') { $url .= "&var1="; $error = 1; } else { $url .= "&var1=".urlencode(stripslashes($var1)).""; } Then repeat for $var2, $var3, etc., etc... Is there a better way of doing this looping instead of writing the same routine over and over again? AMK4 -- H | Hi, I'm currently out of my mind. Please leave a message. BEEEEP! |____________________________________________________________________ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130 Director of Internet Operations / SysAdmin . 800.441.3873 x130 Photo Craft Laboratories, Inc. . eFax 248.671.0909 http://www.pcraft.com . 3550 Arapahoe Ave, #6 .................. . . . . Boulder, CO 80303, U.S.A.

« previous php.general (#49918) next »