11 Replies Latest reply: Aug 2, 2012 10:44 AM by NeoGen Hawk RSS

    Form to Mail

    NeoGen Hawk Community Member

      Hi all,

       

      I know this question has been asked in the past, but knowing how technology and techniques move on thought that the answers may be different.

       

      I want to create a nice loking contact form, the information I need it to contain id:

       

      Name:_____________________

       

      Email Address:_____________________

       

      Contact Number:_____________________

       

      Date:_____________________

       

      Message:_____________________

       

      I've looked at the company that host my site and they have the following code:

       

      <?php

       

       

      $EmailFrom = "info@yourdomain.co.uk";

      $EmailTo = "info@yourdomain.co.uk";

      $Subject = "online form";

      $Name = Trim(stripslashes($_POST['Name']));

      $Email = Trim(stripslashes($_POST['Email']));

      $Tel = Trim(stripslashes($_POST['Tel']));

      $Message = Trim(stripslashes($_POST['Message']));

      // validation

      $validationOK=true;

      if (!$validationOK) {

        echo "please check your details";

        header("Location: http://yourdommain.co.uk/contact.php");

        exit;

      }

       

       

      // prepare email body text

       

       

      $Body = "";

      $Body .= "Name: ";

      $Body .= $Name;

      $Body .= "\n";

      $Body .= "Tel: ";

      $Body .= $Tel;

      $Body .= "\n";

      $Body .= "Email: ";

      $Body .= $Email;

      $Body .= "\n";

      $Body .= "Message: ";

      $Body .= $Message;

      $Body .= "\n";

       

       

      // send email

      $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

       

       

      // redirect to success page

      if ($success){

        print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";

      }

      else{

        print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";

      }

      ?>

       

       

      What I'm not 100% on is designing the form in Dreamweaver and then tying the form in with the php file and getting the information emailed back to me. I did try downloading one from the net but just kept getting an error message so decided to try a different approach.

       

      Any help would be grestly appreciated.

       

      Many thanks

       

       

       

      Nick