Jump to content

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 = 'tim@gtwebconcepts.com';

$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 = 'tim@gtwebconcepts.com';
   $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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.