Jump to content

[SOLVED] Error on textarea if Enter is pressed twice


bnther

Recommended Posts

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

 

 

?>

 

 

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.