On Wed, Sep 19, 2001 at 12:57:07PM +0100, L Melville wrote:
> Hi,
> 
> I have a php page that accepts post values (ie;
> ...../page.php?var1=0&var4=5).
> 
> Now there can be posted values between var(1) and var(10) and i want to
> check if they exist and also utilise them.  Is there a way of accessing
> these values in a loop ie;-
> 
> for($i=1;$i<=10;$i++){
>     // do things in here that access the vars like this
>     $blah = $var$i;
> }

Something like this should work:

<?php
$var4 = 'Hello';

for($i=1;$i<=10;$i++){
    // do things in here that access the vars like this
    $blah = "var$i";
    if(isset($$blah)) {
       echo $$blah."<br>\n";
    }
}
?>


-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
Well, that's more-or-less what I was saying, though obviously addition
is a little more cosmic than the bitwise operators.
             -- Larry Wall in <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to