Re: Making variables with an iteration? STILL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Robert,

Monday, December 6, 2004, 3:55:21 PM, you wrote:

RS> <snip>
RS> <?php
RS> for ($i=1; $i<10; $i++)
RS> {
RS>   if (isset ($_POST['choice'.$i]))
RS>   {
RS>    for ($j=1; $j<5; $j++)
RS>    {
RS>     $tempChoice = "choice" . $j;
RS>     $$tempChoice = $_POST['choice'.$i];
RS>    }
RS>   }
RS> }

RS>    echo $choice1;
RS>    echo $choice2;
RS>    echo $choice3;
RS>    echo $choice4;
?>>
RS> </snip>

RS> The problem seems to be that it is only doing this on the last one, no matter
RS> which one it is...  I know it is in the iterations, but I can't place my finger
RS> on where I need to change things up.

Why not just use extract() on the $_POST values with a pre-defined
list of variables and use the EXTR_IF_EXISTS option to make it more
secure?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux