Re: batch process all variables

From: Date: Thu, 02 Nov 2000 08:37:59 +0000
Subject: Re: batch process all variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23350@lists.php.net to get a copy of this message
I would do this - put all of your fields in an array like this: <INPUT TYPE="text" NAME="f[a]"> <INPUT TYPE="text" NAME="f[b]"> <INPUT TYPE="text" NAME="f[c]"> <INPUT TYPE="text" NAME="f[d]"> <INPUT TYPE="text" NAME="f[e]"> <INPUT TYPE="text" NAME="f[f]"> then this when you are good to go: <? while(list($key,$val) = each($f)){ // str_replace is faster in this instance ... no matching involved $return_array[$key] = str_replace('_',' ',$val); // not sure what this is doing ... maybe trim() ??? $return_array[$key] = substr($val,0,4000); // is there a space here ??? $return_array[$key] = strip_tags($val); } ?> $return_array will then be your processed variables. --Joe On Thu, Nov 02, 2000 at 01:44:02PM +1100, Justin French wrote: > hi, > > i have a huge form which i need to do certain security and formating > things to the variables supplied by the form. > > anyway simple way i can batch process a huge list of variables if i know them? > > eg: > List of vars i wish to process: > $a > $b > $c > $d > $e > > List of things I wish to do: > ereg_replace( "_", " ", $all_the_vars_i_listed_above ); > substr ($all_the_vars_i_listed_above, 0, 4000); > strip_tags($all_the_vars_i_listed_above); > > > OR alternatively, can I process ALL VARS THAT PHP KNOWS OF, rather than > a list? > > > help much appreciated, this is a big job... > > > justin > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ================================================================================ = Joe Stump joestump98@yahoo.com http://www.miester.org = ================================================================================ "Real programmers don't comment their code. It was hard to write, it should be hard to understand."

« previous php.general (#23350) next »