Re: Variable $_POST vars?

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

 



Stephen,

I'm using a template and so:
    <input name="item{number}" size=60 class="formdata" value="{item}">
becomes:
    <input name="item1" size=60 class="formdata" value="{item}">

....and so on.

But when I need to get the post data, I cannot access in the way I'm used to 
like:

$var1 = $_POST['item1'];
$var2 = $_POST['item2'];

If its in an array, how do I loop thru a POST array?

"Stephen Johnson" <maillists@xxxxxxxxxxxxxxxx> wrote in message 
news:BFC0FAE2.2155C%maillists@xxxxxxxxxxxxxxxxxxx
>I would do this instead
>
> <input name="item[$var]" size =60 class="formdata" value="item">
>
> Increment the $var with the {number} that you are using.
>
> In the following PHP page
>
> You would do
>
> $var = $_POST['item'];
>
> $var would then be an array accessed the same way you would access it
> normally.
>
> Does that make sense.?
>
> On 12/10/05 9:27 PM, "The.Rock" <czimmerman01@xxxxxxxxxxx> wrote:
>
>> Here is an example of one of the fields:
>> <input name="item{number}" size=60 class="formdata" value="{item}">
>>
>> I'm looping thru this form several times, so each time the name gets
>> incremented. Do you have an example of what your talking about?
>
> -- 
> Stephen Johnson
> The Lone Coder
>
> http://www.ouradoptionblog.com
> *Join us on our adoption journey*
>
> stephen@xxxxxxxxxxxxxxxx
> http://www.thelonecoder.com
>
> *Continuing the struggle against bad code*
> -- 

-- 
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