If you just want ALL the fields of the form the appear one after the other
(with something \n after each), then you could just loop through the POST
vars (assuming you used <form action="blah.php" method="post">), which would
be either in the $_POST array or the $HTTP_POST_VARS array.

something like:

<?
// untested code

$msg = "Type email header here\n\n";

foreach($_POST as $key => $value)
    {
    $msg .= "{$key}: {$value}\n";
    }

$msg .= "\nEmail footer here";

mail($to, $subject, $msg, $headers);

?>

Assuming you had the usual $first_name / $last_name / $email_address /
$password kinda form, this would result in an email something like:
---
Type email header here

first_name: Justin
last_name: French
email_address: [EMAIL PROTECTED]
password: foofoo

Email footer here
---


Warning:

1. this leaves you wide open to evil people submitting evil things via the
form... I'd look at strip_tags(), trimming longer than expected strings,
etc.

2. this doesn't give you much in the way of formatting options, or breaking
the vars into sections


For a totally secure form, with trusted data, I'd be coding the message body
by hand checking to make sure that the values submitted were not suspicious,
and were as expected.

However, for a quick-and-nasty form, or for an intranet where you trust the
submitters (eg your own staff perhaps), this *might* be sufficient.


Justin French
    



Jeremy Bowen wrote:
> Hey,
> 
> I have looked in PHP manual but I cannot seem to find what I am looking for.
> 
> I have a very large form that I need to be able to mail. I just don't want
> to have to code all of the field into my mail() function.
> 
> Thanks,
> 
> Jeremy


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to