Hi,
Assuming you use POST in your form, and there is a field called "Name" and a field called "Email", and you check for a submission with "send" (i.e <Input type="submit" name="send">), this code takes whatever fields you have and mail them to xxxxx@xxxxxx
put this at top of your page (for example)
if ($send){
parse_form_and_mail();
} else {
html for for the form goes here ....
}
dont forget to declare or include following code:
function parse_form_and_mail(){
global $HTTP_POST_VARS;
$Email = $HTTP_POST_VARS[Email];
while (is_array($HTTP_POST_VARS)
&& list($key, $val) = each($HTTP_POST_VARS))
{
if ($key == 'send'):
$val = "";
$key = "";
else:
$otherkey .= "<" . $key . ">\n" .$val . "\n\n";
endif;
}
///////////////////////////////////////
//Mail a confirmation to the admin
///////////////////////////////////////
$datestamp = date ("Y-m-d",time()) ;
$timestamp = date ("H:i",time()) ;
$tiden = "\n\n(letter was sent $datestamp, at $timestamp)";
$body = $otherkey . $tiden;
mail("xxxxx@xxxxxx","Message from my form",$body,"From: $Name <$Email>
}
hth
Christian Albinsson
christian@korridor.se