[ciapug] POST array and iterating through it

Chris Hettinger ciapug@cialug.org
Tue, 23 Dec 2003 01:22:22 -0600


Ahh.. now looking at it, you're right... $array = $_POST was a bit 
superfluous wasn't it. hehe. Thanks.

Lathrop Preston wrote:
> 
> That will work.
> 
> Just for reference unless you need to traverse the array again you can 
> skip the $array  = $_POST; command.
> 
> another way to do it...
> 
> while(list($key,$val) = each($_POST))
> 
> I think it is list() anyway....
> 
> I think all this is right...
> 
> Laith tired... Laith go to sleep...
> 
> 
> 
> 
> Chris Hettinger wrote:
> 
>> I think I got it to work in my test,
>>
>> $array = $_POST;
>>
>>
>>>> I got stuck for a moment unsure if I could do the above, brain fart.
>>
>>
>>
>> foreach ($array as $key => $value) {
>>    echo "Key: $key; Value: $value<br>\n";
>> }
>>
>> OUTPUT
>>
>> Key: formName; Value: custserv
>> Key: name; Value: Chris Hettinger
>> Key: email; Value: cjh@raccoon.com
>> Key: phone; Value: 515-205-5711
>> Key: ins_carrier; Value: Key: comments; Value: Blah
>> Key: btn_submit; Value: Submit
>>
>>
>> I will now work on the formatting for the mail message.
>>
>> -ch
>>
>> -----Original Message-----
>> From: Chris Hettinger Sent: Monday, December 22, 2003 10:17 AM
>> To: Ciapug (E-mail)
>> Subject: [ciapug] POST array and iterating through it
>>
>>
>> I am working on a quick script to handle emailing the results of input 
>> into a few forms.
>>
>> Since the forms vary just a small bit in the number of form fields I 
>> would like to have my it, on submit, iterate through the $_POST array, 
>> and for each line include in the body of the message it's Key (name of 
>> the field) and the Value (input).
>>
>> My question is how to best iterate through that array.
>>
>> -Chris Hettinger, Web Specialist
>> -IFMC/ENCOMPASS
>> -www.encompas.com
>> -(515) 279-8730
>>
>>
>>
>> CONFIDENTIALITY NOTICE:  This communication, including any attachment, 
>> may contain confidential information and is intended only for the 
>> individual or entity to whom it is addressed.  Any review, 
>> dissemination, or copying of this communication by anyone other than 
>> the intended recipient is strictly prohibited.  If you are not the 
>> intended recipient, please contact the sender by reply email, delete 
>> and destroy all copies of the original message.'
>>
>> _______________________________________________
>> ciapug mailing list
>> ciapug@cialug.org
>> http://cialug.org/mailman/listinfo/ciapug
>>
>>
>> CONFIDENTIALITY NOTICE:  This communication, including any attachment, 
>> may contain confidential information and is intended only for the 
>> individual or entity to whom it is addressed.  Any review, 
>> dissemination, or copying of this communication by anyone other than 
>> the intended recipient is strictly prohibited.  If you are not the 
>> intended recipient, please contact the sender by reply email, delete 
>> and destroy all copies of the original message.'
>>
>> _______________________________________________
>> ciapug mailing list
>> ciapug@cialug.org
>> http://cialug.org/mailman/listinfo/ciapug
> 
> 
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>