|
Posted by JackM on 02/01/07 01:02
Rik wrote:
> JackM <notme@earthlink.net> wrote:
>
>
>
>> When I print out print_r($_POST);, I get everything passed correctly as:
>>
>> Array
>> (
>> [NewClass] => Array
>> (
>> [0] => Wed
>> [1] => Fri
>> )
>>
>> [NewClass-Time] => 9:00 am
>> )
>>
>> But when it gets emailed, the results listed on the email I get are
>> as follows:
>>
>> NewClass: Array
>>
>> NewClass-Time: 9:00 am
>>
>> I stripped the processing script down to the barest of essentials.
>> All that's on it right now is:
>>
>> foreach($_POST as $key =>
>> $value){if(!(!isset($value))){$set=1;}$message = $message . "$key:
>> $value\n\n";}
>
>
> $value will always be set, even if it's an empty string (a lot of
> browsers default to on though). So what the "if(!isset($value))" does?
>
> foreach($_POST as $key => value){
> $message = $key . ': '.((is_array($value)? implode(',',$value):
> $value);
>
> }
So if I'm reading that correctly, that's another way of saying:
foreach($_POST as $key => $value){
if(is_array($value)){
$message = $message . "$key: ".implode( ', ', $value)."\n\n";
} else {
$message = $message . "$key: $value\n\n";
}
}
Close interpretation, maybe? At least the code works. ;-)
[Back to original message]
|