I am wanting to pull down a group of variables from a URL using $_GET.

I have no problem posting my variables with:

<?php echo "select name=\"cal_" . $myrow[foodid] . "\">"; ?>

resulting in:
http://url??cal_1=2&cal_2=0&cal_3=0...

So then I need to get the variables back out. Instead of:

$a=$_GET['cal_1'];
$b=$_GET['cal_2'];...

I want to:

${'a' . myrow[foodid]} = $_GET['cal' . myrow[foodid]};

There my be about 50 of these variables passed throught the URL, and thus i want to GET dynamic variables instead of going line-by-line.

Any suggestions?

    not sure i totally undertsand, you want create individual variables from the $_GET array? if so use the [man]extract[/man] function.

      Hmmm... I'm not sure how that might work. Lets try it this way - the effect I want to acheive is:

      ... = $_GET[$var]

      instead of:

      ... = $_GET['var']

        Ah - found it...

        $_GET["var" . $var];

        Thanks for your help.

          Write a Reply...