Skip navigation
NeoGen Hawk
Currently Being Moderated

Form to Mail

Jul 30, 2012 1:23 PM

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

 
Replies
  • Currently Being Moderated
    Jul 30, 2012 1:39 PM   in reply to NeoGen Hawk

    I don't think your host's script is adequate.

     

    Ideally, you want a form processing script that validates fields, hides your email address and stops spam from every reaching you.   FormM@ailer.php from DB Masters does all this and more.  http://www.dbmasters.net/node/18   See their tutorial for further details.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 1:46 PM   in reply to NeoGen Hawk

    Hi Nick -

     

    The host's form is configured and saved usually something like sendmail.php and uploaded to your server

     

    The HTML form code for your contact page will have a first line of code specifying the other file as the target of it's action (post or get)

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 31, 2012 9:36 AM   in reply to NeoGen Hawk

    Nick,

    FormM@ailer.php works for me.   Try this link: http://tinyurl.com/btmytf6

     

    OR

        FormToEmail.com (free & pro versions available)

        http://formtoemail.com/formtoemail_pro_version.php    

     

        Tectite

        http://www.tectite.com/formmailpage.php

     

     

        Forms to Go from Bebosoft (script generating software)

        http://www.bebosoft.com/products/formstogo/overview/

     

     

        Wufoo.com (on-line form service)

        http://wufoo.com/

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 4:23 AM   in reply to NeoGen Hawk

    NeoGen Hawk wrote:

     

    I need to be able to adapt and blend in to my page

     

    Hi again Nick -

     

    I just wanted to be sure you realize that these mail processing scripts have zero effect on the look of the form displayed on your HTML page. They simply sit, hidden on your server, and handle the email process.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 7:47 AM   in reply to NeoGen Hawk

    Every contact form has 3 parts:

     

    • the HTML <form>,
    • CSS code which styles the form according to your site's design,
    • a script on the server to collect form data and send it where it needs to go.

     

    Most scripts come with a basic, generic form to help you understand how to set it up.  You can style the form any way you wish.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 2, 2012 9:36 AM   in reply to NeoGen Hawk

    For best cross browser results, you should fix your code errors.

     

    In HTML5 doc type, you need to be more disciplined with your code. 

    • The align attribute is obsolete.
    • ID names can be used only one time per page.  Your form contains duplicate entries for tswname and tswemail.
    • Cellpadding is obsolete.

    http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.nick-lawr ence.co.uk%2Fcontact_us.html

     

     

    Nancy O.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points