Simple Contact Form Script?

I am a FrontPage user that has switched to Dreamweaver. I have over 40 client sites. Once I leave Dreamweaver, I'll need new contact forms on the sites (since I won't be using the FrontPage extensions for the contact forms). My host uses formmail (which looks really confusing). But, I want to be sure I am using a script that I can use with my current host (IXwebhosting) or any other host I may go to in the future. In other words, if I ever want to move to a new server or host, I don't want to have to worry about redoing all 40 contact forms again.

I need each form I put on my sites to to be able to have a specfic subject line and be sent to a specific email address.

You can see one of my current forms at: http://usbelt.com/contact.htm

I am a novice at (non-FrontPage) contact forms. Be gentle and talk to me like I'm a first grader :)
gmurray96Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
serjikConnect With a Mentor Commented:
There is simple mail function in php which works fine on mostly servers.
Save it with any filename but with .php extension like form.php and just try.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form</title>
</head>
<body>
 
<?php 
if (isset($_POST['submit'])) {
 
  $to = 'email@to.send';
  $from = $_POST['email']; 
  $subj = '[Mail Subject]';
  $body = ' Email Art:
 
Your Name:
' .$_POST['realname'] . '
 
Email:
' .$_POST['email'] . '
 
Company:
' .$_POST['company'] . '
 
Title:
' .$_POST['title'] . '
 
Location:
' .$_POST['location'] . '
 
 
Phone Number:
' .$_POST['phone'] . '
 
Comment/Question:
' .$_POST['comments'];
 
  // ---- mail function start
  function xmail($to,$from,$subj,$body) { 
    $boundary = md5(uniqid(time(),1)); 
    $add_header ="MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"$boundary\"";
    $mail_content = "--".$boundary."\r\n"
    ."Content-Type: text/plain; charset=utf-8; format=flowed\r\n"
    ."Content-Transfer-Encoding: 8bit\r\n\r\n"
    .$body;
 
    return mail($to,$subj,$mail_content,"From:".$from."\r\n".$add_header);
  }
// ---- mail function end
 
}
?>
 
<form method="POST" action="">
  <p>Email Art:</p>
  <table border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td>Your Name: </td>
      <td><input type="text" name="realname" size=40></td>
    </tr>
    <tr>
      <td>Email: </td>
      <td><input type="text" name="email" size=40></td>
    </tr>
    <tr>
      <td>Company: </td>
      <td><input type="text" name="company" size=40></td>
    </tr>
    <tr>
      <td>Title: </td>
      <td><input type="text" name="title" size=40></td>
    </tr>
    <tr>
      <td>Location: </td>
      <td><input type="text" name="location" size=40></td>
    </tr>
    <tr>
      <td>Phone Number: </td>
      <td><input type="text" name="phone" size=40></td>
    </tr>
    <tr>
      <td valign="top">Comment/Question: </td>
      <td><textarea rows="4" cols="40" name="comments"></textarea>
    </tr>
    <tr>
      <td colspan="2" align="right"> <input type="submit" value="Click to Send"></td>
    </tr>
  </table>
</form>
 
</body>
</html>

Open in new window

0
 
coreybryantCommented:
>> In other words, if I ever want to move to a new server or host,
It depends.  For example, if you use JMail (an ASP component) (http://www.loudexpressions.com/2007/09/processing-the-form-with-the-jmail-email-component) to email the information, then you would want to locate a hosting company that supports JMail.  Most of them do as well as CDOSYS, ASPMail, ASPEMail.  

Formmail does not give us much unfortunately.  I have an olf "processing" form on one site that uses JMail, but the form name is formmail.asp.  But if you are referring to http://www.scriptarchive.com/formmail.html - I have never used that one before.  I heard there were some security issues with it.  It looks like it is a PERL script, so you would make sure that you find a hosting company that supports PERL and that script.  

-Corey
0
All Courses

From novice to tech pro — start learning today.