Page 1 of 1

Newbie :/

Posted: Thu Sep 29, 2011 9:44 am
by irishrobbie
hey lads just starting with php and have a feeling I will need some help along the way and hopefully some of u sound peeps can help :)

I have just created a form but it doesn't work :banghead: the code below is what I used..any ideas what I am doing wrong? :?

Code: Select all

<?
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;


  mail("robert.doran@marketingnetwork.ie", $subject,
    $message, $email, $name, 'From: name' );
  header( "Location: http://www.mntest.net/repak/thankyou.html" );
?>

Re: Newbie :/

Posted: Thu Sep 29, 2011 9:52 am
by Celauran
Your mail() call has too many arguments, for openers. If you're having other problems, please try to be more descriptive than "It doesn't work".

Re: Newbie :/

Posted: Thu Sep 29, 2011 10:00 am
by irishrobbie
Too many arguments, for openers?!

haha sorry well it works if I do it like this...but then I don't get whats put in the 'name' field in the email?! I was hoping i would get the name as the sender but it comes in from User U117280??

Code: Select all

<?
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;

  mail( "robert.doran@marketingnetwork.ie", $subject,
    $message, $email, "From: $name" );
  header( "Location: http://www.mntest.net/repak/thankyou.html" );
?>

Re: Newbie :/

Posted: Thu Sep 29, 2011 11:20 am
by irishrobbie
Anyone?! :(

Re: Newbie :/

Posted: Thu Sep 29, 2011 12:03 pm
by AbraCadaver

Code: Select all

$to = "robert.doran@marketingnetwork.ie";
$options = "-f$email";
$headers = "From: $name<$email>\r\n"
."Reply-To: $email\r\n"
."X-Mailer: PHP/" . phpversion();

mail($to, $subject, $message, $headers, $options);