Form to mail

Would you like to get on your email all the information included in a form?

  • First of all you need a form, as for example the one in the table:

<FORM ACTION="formtomail.php" METHOD=post>

<!-- Your fields here -->

<INPUT TYPE=submit value="Submit">

    The Form Action must be directed to the PHP script bellow.
  • Second: you need the php script (copy the information in the table to a text file
  • and save the file as "formtomail.php" in your server).
if ($_POST){
      // posted information is added to variable message
      foreach ($_POST as $formfieldname => $formfieldvalue){
message.="$formfieldname \n $formfieldvalue\n\n";     //
     // send email with information from the form to
mail("","Form to Mail", $message,"From: <>\nContent-Type: text/plain");
      print "The information has been send to webmaster";
      print "No information has been posted";

You need to customize the script: substitute red text in the script by your email.

This scripts assumes you have no restrictions to use mail commnad.