Re: Looping through variables

From: Date: Tue, 24 Apr 2001 18:00:36 +0000
Subject: Re: Looping through variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-50136@lists.php.net to get a copy of this message
Dan Lowe wrote: > // List of variable names > $var_list = array ( 'var1', 'var2', 'var3', 'var4' > ); > > while (list($key,$val) = each($var_list)) { > if ($$val == '') { > $url .= "&".$val."="; > $error = 1; > } else { > $url .= "&".$val."=". urlencode(stripslashes($$val)) > .""; > } > } Goodie. This is what I needed (as opposed to looping through the POST Array because not all of them are being evaluated as blank. Some of them actually have something in them and I have to eval those differently. AMK4 -- W | | I haven't lost my mind; it's backed up on tape somewhere. |____________________________________________________________________ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130 SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. . eFax 248.671.0909 http://www.pcraft.com . 3550 Arapahoe Ave #6 .................. . . . . Boulder, CO 80303, USA

« previous php.general (#50136) next »