bnther Posted April 13, 2009 Share Posted April 13, 2009 I've just started using PHP and I've setup a e-mail form with a textarea. Everything works fine until I pressed Enter twice (for spacing) in the text area. Don't know why this would make a difference, but it pukes everytime. Any thoughts would be appreciated. Error reads: Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/b/n/t/bnther39/html/ServerSide.php on line 10 Code reads; <?php $to = '[email protected]'; $name = $_POST['Name']; $email = $_POST['Email']; $comments = $_POST['comments']; // $message = 'Thank you'; mail($to, $name, $email, $comments);//this is line 10 ?> Link to comment https://forums.phpfreaks.com/topic/153933-solved-error-on-textarea-if-enter-is-pressed-twice/ Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 What's with the $comments. Mail()'s parameters are bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) So you're putting $comments in the header. Could possibly be why it's not working. Link to comment https://forums.phpfreaks.com/topic/153933-solved-error-on-textarea-if-enter-is-pressed-twice/#findComment-809010 Share on other sites More sharing options...
laffin Posted April 13, 2009 Share Posted April 13, 2009 nice catch, I think the extra parameter is $name remove that shud be ok email/to can look like, [email protected] or <'Real Name'> [email protected] I believe, been awhile since I used mail function Link to comment https://forums.phpfreaks.com/topic/153933-solved-error-on-textarea-if-enter-is-pressed-twice/#findComment-809016 Share on other sites More sharing options...
bnther Posted April 13, 2009 Author Share Posted April 13, 2009 $comments is the label for the textarea. Taking $name out did fix the problem, but obviously I don't get the name information now. Somehow I get the feeling that I'm not doing this quite right. Link to comment https://forums.phpfreaks.com/topic/153933-solved-error-on-textarea-if-enter-is-pressed-twice/#findComment-809060 Share on other sites More sharing options...
premiso Posted April 13, 2009 Share Posted April 13, 2009 Well what is your goal. Look at what jack posted for the usage of mail. $to = '[email protected]'; $name = $_POST['Name']; $from = $_POST['Email']; $comments = $_POST['comments']; $subject = "Thank you {$name}"; mail($to, $subject, $comments, "From: {$from}\r\n"); Would probably do what you want. Link to comment https://forums.phpfreaks.com/topic/153933-solved-error-on-textarea-if-enter-is-pressed-twice/#findComment-809063 Share on other sites More sharing options...
bnther Posted April 14, 2009 Author Share Posted April 14, 2009 Thanks for the help everyone. It's working now. I'm still trying to get it formated the way that I want, but all of the information is coming through without a hitch. Kudo's to everyone! Link to comment https://forums.phpfreaks.com/topic/153933-solved-error-on-textarea-if-enter-is-pressed-twice/#findComment-809076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.