Re: combining variables...

From: Date: Tue, 06 Apr 2004 19:11:21 +0000
Subject: Re: combining variables...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-182525@lists.php.net to get a copy of this message
* Thus wrote Tristan.Pretty@risk.sungard.com (Tristan.Pretty@risk.sungard.com): > Sadly, it didnb't work... > > here's my code... I wanna repeat and output final variables 6 times... > > ====================================== > > for ($i = 1; $i <= 6; $i++) { > > if ($view_request_bu_$i != '') { > $view_request_$i = strtolower($view_request_bu_$i); > } else if ($view_request_email_$i != '') { > $view_request_$i = strtolower($view_request_email_$i); You might also want to look at how you can pass variables as arrays so you dont have to do all these needless checking. <input name="view_request[email][]"> <input name="view_request[company][]"> foreach($view_request as $key => $list) { for ($i = 1; $i <= 6; $i++) { if ($list[$i] != '') { $view_request[$key][$i] = strtolowert($list[$i]); } else { $view_request[$key][$i] = "Error";; $view_request_$i = } } } see: http://php.net/variables.external Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#182525) next »