jmrodger Posted February 15, 2010 Share Posted February 15, 2010 Hello. Am using this html form along with the below php ("myemail" and "mydomain" changed for privacy) and keep getting this error message: Warning: mail() expects at most 5 parameters, 7 given in /home/public_html/surveymail.php on line 10 Can anyone take a look and advise? Thanks so much! COPY/PASTE OF HTML FORM: <form method="post" action="surveymail.php"> <p align="left">Thank you for visiting our church recently! You matter to us and so does your opinion. We would appreciate your feedback on the following four questions:<br /> </p> <TABLE BORDER=0 CELLSPACING=3> <TR> <TD ALIGN=Left>Name: <TEXTAREA NAME="name" ROWS="1" COLS="20"> </TEXTAREA> Email: <TEXTAREA NAME="email" ROWS="1" COLS="20"></TEXTAREA><br /> <br /></TD> </TR> <TR> <TD ALIGN=Left>What Did You Notice First?<br /> <TEXTAREA NAME="message1" ROWS="3" COLS="65"> </TEXTAREA><br /> <br /></TD> </TR> <TR> <TD ALIGN=Left>What Did You Like Best?<br /> <TEXTAREA NAME="message2" ROWS="3" COLS="65"> </TEXTAREA><br /> <br /></TD> </TR> <TR> <TD ALIGN=Left>Overall Impression?<br /> <TEXTAREA NAME="message3" ROWS="3" COLS="65"> </TEXTAREA><br /> <br /></TD> </TR> <TR> <TD ALIGN=Left>How Can We Pray for You?<br /> <TEXTAREA NAME="message4" ROWS="3" COLS="65"> </TEXTAREA><br /> <br /></TD> </TR> </TABLE> <INPUT TYPE="SUBMIT" VALUE="Submit"><INPUT TYPE="RESET" VALUE="Clear"> </FORM> USING WITH THIS surveymail.php PAGE: <?php $email = $_REQUEST['email'] ; $message1 = $_REQUEST['message1'] ; $message2 = $_REQUEST['message2'] ; $message3 = $_REQUEST['message3'] ; $message4 = $_REQUEST['message4'] ; mail( "[email protected]", "Guest Survey Form", $message1, $message2, $message3, $message4, "From: $name <$email>" ); header( "Location: http://www.mydomain.org/thanks.php" ); ?> Link to comment https://forums.phpfreaks.com/topic/192205-new-to-php-and-dont-know-what-im-doing/ Share on other sites More sharing options...
jl5501 Posted February 15, 2010 Share Posted February 15, 2010 you cant put multiple messages in the call to mail. if there are multiple bits of text to send, concatanate them first and include that as the message like $message = $message1 . $message2 . $message3 . $message4; after your $message1 = $_REQUEST['message1'] ; $message2 = $_REQUEST['message2'] ; $message3 = $_REQUEST['message3'] ; $message4 = $_REQUEST['message4'] ; and before the call to mail() Link to comment https://forums.phpfreaks.com/topic/192205-new-to-php-and-dont-know-what-im-doing/#findComment-1012886 Share on other sites More sharing options...
idontkno Posted February 16, 2010 Share Posted February 16, 2010 you cant put multiple messages in the call to mail. if there are multiple bits of text to send, concatanate them first and include that as the message like $message = $message1 . $message2 . $message3 . $message4; after your $message1 = $_REQUEST['message1'] ; $message2 = $_REQUEST['message2'] ; $message3 = $_REQUEST['message3'] ; $message4 = $_REQUEST['message4'] ; and before the call to mail() And your "From" header is going to literally send "From: $name <$email>" instead of "From: Bob <[email protected]>" Link to comment https://forums.phpfreaks.com/topic/192205-new-to-php-and-dont-know-what-im-doing/#findComment-1012889 Share on other sites More sharing options...
jmrodger Posted February 16, 2010 Author Share Posted February 16, 2010 Wow, that was fast. Thanks so much! Any way to separate the results from within each message field? Results are all smashed together in the email body. But hey, I'm just happy that this works now!! Link to comment https://forums.phpfreaks.com/topic/192205-new-to-php-and-dont-know-what-im-doing/#findComment-1012899 Share on other sites More sharing options...
idontkno Posted February 16, 2010 Share Posted February 16, 2010 Wow, that was fast. Thanks so much! Any way to separate the results from within each message field? Results are all smashed together in the email body. But hey, I'm just happy that this works now!! Add an end of line. $message1 = $_REQUEST['message1'] . PHP_EOL; Link to comment https://forums.phpfreaks.com/topic/192205-new-to-php-and-dont-know-what-im-doing/#findComment-1012905 Share on other sites More sharing options...
jmrodger Posted February 16, 2010 Author Share Posted February 16, 2010 Perfect!! Thanks again. Link to comment https://forums.phpfreaks.com/topic/192205-new-to-php-and-dont-know-what-im-doing/#findComment-1012930 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.