RE: [PHP] *OK, more eval for today
| From: | John W. Holmes | Date: | Wed, 18 Dec 2002 19:17:40 +0000 |
| Subject: | RE: [PHP] *OK, more eval for today | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128763@lists.php.net to get a copy of this message | ||
Why not name your form elements php_q3[] and then just loop through the
array. That would cut the need for eval().
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: Alexey Lysenkov [mailto:man@xtati.com]
> Sent: Wednesday, December 18, 2002 2:08 PM
> To: php-general@lists.php.net
> Subject: [PHP] *OK, more eval for today
>
> I know, it's eval = evil, but I don't see any other way I can check
for
> 120 variables submitted via post, without making a temp variable,
> assigning a value of the posted Var and checking for it (and deciding
on
> the further run of the script). Anyways, I took a classical eval thing
and
> am doing fine with it. It looks like this:
>
> $temp = "\$php_q3_".$i; // $i is a loop index
> eval ("\$temp = \"$temp\";");
>
> works alright. Now, how do I eval directly from the $HTTP_POST_VARS?
>
> I am trying to do this:
>
> $tempVar1 = '\$HTTP_POST_VARS[\"q4_'.$i.'"]';
> eval("\$tempVar1=\"$tempVar1\";");
>
> and am obviously failing. If you know any other way to validate
120-150
> variables in a loop and then rewrite the values into the fields
> (checkboxes, radios and selects) - should an error had been made - let
me
> know.
>
> Best Regards,
> Alex
>
> p.s. you do help! :)