Web Analytics Made Easy -
StatCounter email submit form problem - CodingForum

Announcement

Collapse
No announcement yet.

email submit form problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • email submit form problem

    I have a submit form but when somone fills up and click submit
    either an error message, nothing happens, and I don't received
    anything.

    Can someone help me to correct the problem!
    The Website Company who's the host for my site
    gave this but....it does not work.


    My website page where my email form is
    http://www.mydomain.com/contactus.html

    I tried using this
    <html>
    <table>
    <form method="post" name="inquiry" action="http://www.mydomain.com/cgi-bin/cgiemail/contactus.html">
    <input type="hidden" name="recipient" [email protected]">
    <input type="text" size="35" maxlength="256" name="telephone">
    etc....etc....etc....

    <input type="submit" name="submit" value="submit">
    </form></table></html>

  • #2
    use php
    Code:
    <?php if($_GET['contact']) {
    // Edit this
    $to         = "[email protected]";
    $fname       = $_POST['fname'];
    $lname       = $_POST['lname'];
    $email        = $_POST['email'];
    $mesage   = $_POST['mesage'];
    // Edit the Subject
    $sub        = "Contact email form yoursitename";
    // No more editing needed below here
    $headers    = "From: $fname $lname <$email>\n";  
    $headers   .= "Content-Type: text/plain; charset=iso-8859-1\n";
    $mes        = "First Name: ".$fname."\n";
    $mes       .= "Last Name: ".$lname."\n";
    $mes       .= "Email: ".$email."\n";
    $mes       .= "Message: ".$mesage."\n";
    if(empty($fname) || empty($lname) || empty($email) || empty($mesage)) {
         echo " <h3><center>Please fill out all the fields</center></h3>";
    } elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
         print "   <<h3><center>Sorry the email address you entered looks like it's invalid</center></h3>";
    } else {
         mail($to, $sub, $mes, $headers);
         print "   <h3><center>Thank you. ".$fname." we will respond within 24-48 hours </center></h3>";
    }
    }
    ?>
    <form method="post" action="?contact=true">
    <div align="center">
    First Name:&nbsp;<input name="fname" type="text" size="30"><br>
    Last Name:&nbsp;<input name="lname" type="text" size="30"><br>
    Email:&nbsp;<input name="email" type="text" size="30"><br>
    Message:<br><textarea name="mesage" cols="50" rows="5"></textarea>
    <br>
    </div>
    </form>
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    There are 3 kinds of ppl those who can count and those who cant
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Script-Megafest.com Coming Oh so very soon

    Comment


    • #3
      ...or you can try using this. It is submitted by email.

      Code:
      <form name="" method="post" enctype="text/plain" action='mailto:emailaddress'>
      
      <label for="firstname">First Name</label>
      <input type="text" name="firstname" value="" /><br />
      
      <label for="from">Email Address:</label>
      <input type="text" name="from" value="" /><br />
      
      <label for="subject">Subject</label>
      <input type=text name="subject"><br />
      
      <label for="message">Message</label>
      <textarea name="message"></textarea><br />
      
      <input type="submit" value="Submit" id="submitbutton" />
      
      </form>
      Get Mozilla Firefox

      Comment

      Working...
      X