Jump to content

kev_77

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kev_77's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. kev_77

    mail.php

    OK trawled the forums and cobbled this answer together which works almost exactly as I need. The only thing that doesn't work is the redirect at the end of the file: <?php $email_address = "me@mydomain.com"; //need to change to your address $subject = "Contact from Website"; $name = $_POST['Name']; $email = $_POST['Email']; $telephone = $_POST['Telephone']; $comments = $_POST['Comments']; $message ="Contact Name:".$name."\n\nEmail-Address:".$email."\n\nTelephone:".$telephone."\n\nComments:".$comments; mail($toname."<".$email_address.">",$subject,$message,"From: ".$name."<".$email.">"); //Redirects to index.htm header("Location: index.htm") ?> Any ideas? Regards Kevin
  2. kev_77

    mail.php

    Thanks for the reply, as I said initially, I am very new to this and don't quite understand your answer. Are you saying all I need to do is enter the line, $example_from_form = $_post['name']; and it will populate the mail I receive? $to = ' me@mydomain.com'; $subject = 'Web Enquiry'; $message = 'From: ' . $_REQUEST['Name'] . "\n\n" . $_REQUEST['Comments']; $email = $_REQUEST['Email']; $headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $example_from_form = $_post['myform']; mail ($to, $subject, $message, $headers); header("Location: index.htm"); Also, what about the redirect? Sorry if these questions appear a little "green". Regards Kevin
  3. I realise this may have been covered many times before but I am very new to php and can't seem to find what I am looking for in the forum. Basically I am calling mail.php from my form. The form is very simple and has only 4 fields, Name, Email, Telephone and Comments. My hosting company sent me the following mail.php to use but I don't know how to include the form fields: <? $to = ' me@mydomain.com'; $subject = 'Web Enquiry'; $message = 'From: ' . $_REQUEST['Name'] . "\n\n" . $_REQUEST['Comments']; $email = $_REQUEST['Email']; $headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail ($to, $subject, $message, $headers); header("Location: index.htm"); ?> Once submitted (obviously changing the e-mail address) I duly receive an e-mail containing from, Name and comments. How do I add further fields such as Telephone etc? Also, the redirect doesn't work? I was told that after submission, the user would be redirected to the home page? Your answers are much appreciated Kevin
×
×
  • 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.