Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Formatting data

0 views
Skip to first unread message

Shane McBride

unread,
Jan 29, 2003, 1:33:32 PM1/29/03
to
Hi there!

I am using formmail.php to process a VERY large form. The problem is
that there is so much data that the resulting email is rather
confusing.

I have added a tab (\t) to the script to help separate the field and
values. That's ok.

Is there a way to get the tabs to arrange like columns????

Here's a snippet:
// parse the form and create the content string which we will send
function parse_form($array) {
// build reserved keyword array
$reserved_keys[] = "MAX_FILE_SIZE";
$reserved_keys[] = "required";
$reserved_keys[] = "redirect";
$reserved_keys[] = "email";
$reserved_keys[] = "require";
$reserved_keys[] = "path_to_file";
$reserved_keys[] = "recipient";
$reserved_keys[] = "subject";
$reserved_keys[] = "bgcolor";
$reserved_keys[] = "text_color";
$reserved_keys[] = "link_color";
$reserved_keys[] = "vlink_color";
$reserved_keys[] = "alink_color";
$reserved_keys[] = "title";
$reserved_keys[] = "missing_fields_redirect";
$reserved_keys[] = "env_report";
if (count($array)) {
while (list($key, $val) = each($array)) {
// exclude reserved keywords
$reserved_violation = 0;
for ($ri=0; $ri<count($reserved_keys); $ri++) {
if ($key == $reserved_keys[$ri]) {
$reserved_violation = 1;
}
}
// prepare content
if ($reserved_violation != 1) {
if (is_array($val)) {
for ($z=0;$z<count($val);$z++) {
$content .= "$key:\t $val[$z]\n";
}
} else {
$content .= "$key:\t $val\n";
}
}
}
}
return $content;
}


- TIA
Shane

James

unread,
Jan 29, 2003, 5:19:10 PM1/29/03
to
On 29 Jan 2003 10:33:32 -0800, sh...@rditech.net (Shane McBride) scrawled:

Try $content .= sprintf("%20s : %s", $key, $value );

0 new messages