Newbie :/

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
irishrobbie
Forum Newbie
Posts: 3
Joined: Thu Sep 29, 2011 9:37 am

Newbie :/

Post 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" );
?>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Newbie :/

Post 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".
irishrobbie
Forum Newbie
Posts: 3
Joined: Thu Sep 29, 2011 9:37 am

Re: Newbie :/

Post 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" );
?>
irishrobbie
Forum Newbie
Posts: 3
Joined: Thu Sep 29, 2011 9:37 am

Re: Newbie :/

Post by irishrobbie »

Anyone?! :(
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Newbie :/

Post 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);
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply