I am trying to code a contact form with 6 text boxes (name, email, what picture they want to buy, etc.) but I keep getting this error. Warning: mail() expects at most 5 parameters, 7 given in /*sendmail.php on line 12 Code (markup): Here is my sendmail.php text <? $email = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $print = $_REQUEST['print'] ; $size = $_REQUEST['size'] ; $number = $_REQUEST['number'] ; mail( "*@gmail.com", "Lindsay Test", $name, $print, $size, $number, "From: $email" ); header( "Location: http://www.google.com" ); ?> Code (markup): Any ideas? I'm desperate. Thanks guys.
As the error says, you're sending too many params to the function. Looks like a fair bit of them can be put in the actual mail message.
Your using the function incorrectly. Check the parameters it wants and the examples on how to use it in the php manual. http://www.php.net/manual/en/function.mail.php Also, that is php, not html... wrong forum
You need to make sure your syntax is right. you can't pass a parameter to the mail function called size, for instance. This is the syntax you need to follow: mail( $to, $subject, $message, $additional_headers, $additional_parameters ); PHP: you should do something like this: //create the message you want to send first $message = "You recieved an email!!"; $message = "Name: " . $name . "\n"; $message .= "Print: " . $print . "\n"; $message .= "Size: " . $size . "\n"; $message .= "Number: " . $number . "\n"; //then pass that variable into the function mail( "*@gmail.com", "Lindsay Test", $message, "From: $email" ); PHP: Also, I don't know what you are trying to do with the "*@gmail.com" line. That parameter is where you would put where you want to send it. I don't think you would want to send it to everyone who has a gmail account. I don't even think that would work. I don't know how php would handle that kind of thing. Check out http://us2.php.net/function.mail for info on the mail function.
thanks guys for all your help, here's the code I wound up using in case it can help anyone else <?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $name = $_REQUEST['name'] ; $print = $_REQUEST['print'] ; $size = $_REQUEST['size'] ; $number = $_REQUEST['number'] ; $totalmessage = " Name: $name \n Print: $print \n Size: $size \n Number: $number \n Message: $message \n"; //then pass that variable into the function mail( "*@gmail.com", "Lindsay Test", $totalmessage, "From: $email" ); ?> Code (markup):
Thanks for the info it was very helpful! However, I am wondering (using the example above) If someone does not fill in the size in the form, is there a way to comment out the line in the sendmail form? So if $size =(empty) than this line would not be in the email. Size: $size \n