php warning message

A

Anonymous

Guest
I get the following message:

Warning: mail() expects at most 5 parameters

I know what it means, but how do I get my code to allow more than 5 fields?

This is my send mail code section

elseif (mail($email,$subject,$from,$name,$arrival_day,$arrival_month,$arrival_year,$departure_day,$departure_month,$departure_year,$message))

Thanks Ian
 
Example:
Code:
<?php

mail("$to-address", "$subject", "$name wrote:\n\n$comments\n\n\n From: ip-$REMOTE_ADDR", "FROM: $email");

?>

Or...
Code:
<?php

$message = 'Here goes your complete content for the message body!';

mail("$to-address", "$subject", "$message", "FROM: $email");

?>

If you search on the net for mail script you´ll find a lot of them!

Gesf
 
Thanks for that, yes I'm more confused...

I've searched the web (all search engines) and can't really come up with an answer...

So what you are saying is something like this?

$email = 'reservations@somewhere.com;
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
$from = $HTTP_POST_VARS['from'];
$name = $HTTP_POST_VARS['name'];
$arrival_month = $HTTP_POST_VARS['arrival_month'];
$arrival_year = $HTTP_POST_VARS['arrival_year'];
$departure_day = $HTTP_POST_VARS['departure_day'];
$departure_month = $HTTP_POST_VARS['departure_month'];
$departure_year = $HTTP_POST_VARS['departure_year'];


elseif (mail($subject,$from,$name,$message,$arrival_day,\n$email,\nn$arrival_month,\nnn$arrival_year,\nnnn$departure_day,\nnnnn$departure_month,\nnnnnn$departure_year,)) {

Or have I lost the plot?

Ian
 
Ok I now think I know what you mean:

But it still doesn't work this is what I've changed:

$mail_body = "\nArrival Day: ".$arrival_day;
$mail_body .= "\nArrival Month: ".$arrival_month;
$mail_body .= "\nArrival Year: ".$arrival_year;
$mail_body .= "\nDeparture Day: ".$departure_day;
$mail_body .= "\nDeparture Month: ".$departure_month;
$mail_body .= "\nDeparture Year: ".$departure_year;
$mail_body .= "\nName: ".$name;
elseif(mail($email,$subject,$from,$message,$mail_body)) {

Thanks

Ian
 
I get an unexpected elseif error.

If I remove it I get:

Parse error: parse error, unexpected '{' in \\nas12ent\domains\c\mywebsite.com\user\htdocs\bookings_mail.php on line 43
 
wrong again, use this template (from http://www.php.net/manual/en/function.mail.php):
mail("nobody@example.com", "the subject", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}", "-fwebmaster@{$_SERVER['SERVER_NAME']}");
 
Thanks all,


I've now got it working - now working on the date validations.

Ian
 
Back
Top