Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2007
    Location
    Glencoe, Ontario, Canada
    Posts
    340
    Thanks
    19
    Thanked 27 Times in 27 Posts

    Form does not send

    I cant seem to figure out why this code isnt working. All the error messages pop up for name of theres not name and email for no email and same for message. but when u fill out the form and hit send. The form resets and the Message Error shows up "Let me hear your thoughts"

    Any help with this would be appreciated.

    PHP Code:
    <?php
    //DO NOT REMOVE THIS PHP CODE
    if (isset($_POST['submit'])) {
        
    $name $_POST['Name'];
        
    $email $_POST['Email'];
        
    $message $_POST['message'];
        
        if (empty(
    $name))
            
    $err1 1;
        elseif (empty(
    $email))
            
    $err2 1;
        elseif (empty(
    $message))
            
    $err3 1;
        else {
            if (!
    preg_match('/^([a-z0-9])([\w\.\-\+])+([a-z0-9])\@(([\w\-]?)+\.)+([a-z]{2,4})$/i',$email))
                
    $err4 1;
            else {
                
    $EmailFrom "eric@dragonethosting.com";
                
    $EmailTo "eric@habugfx.com";
                
    $Subject "Habu GFX Contact Form";
                
                
    // prepare email body text
                
    $Body "";
                
    $Body .= "Name: ";
                
    $Body .= $Name;
                
    $Body .= "\n";
                
    $Body .= "Email: ";
                
    $Body .= $Email;
                
    $Body .= "\n";
                
    $Body .= "Message: ";
                
    $Body .= $Message;
                
    $Body .= "\n";

                
    // send email 
                
    $success mail($EmailTo$Subject$Body"From: <$EmailFrom>");
            }
            
        }
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml"> 
     
    <head> 
     
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     
    <title>Venom PC Website</title> 
     
    <meta http-equiv="keywords" content="pc,venom pc,computers,custom,built,justin" /> 
     
    <link href="include/style.css" media="all" rel="stylesheet" />
    <script type="text/javascript" src="include/scripts/validate.js">
        /**
        Script Title: Form Validation for Habu GFX
        Script Author: Raymond Angana
        Date Created: 2/22/2009
        This notice must stay intact for legal use
        */
    </script>
    </head> 
     
    <body> 
    <!--start top banner--> 
    <div id="header"> 
    <div id="header_inner"> 
      <div id="header_logo"></div> 
    </div> 
    </div> 
    <!--end top banner--> 
     
    <!--start navigation--> 
    <div id="navwrapper"> 
    <div id="navcontainer"> 
    <ul id="navlist"> 
    <?php include('include/nav.php'); ?>
    </ul> 
    </div> 
    </div> 
    <!--end navigation--> 
     
     
    <!--begin wrapper - note that it ends right bofore the closing body tag--> 
    <div id="main_wrapper"> 
     
    <!--begin left-column content--> 
     
    <div id="left_column"> 
     
        <div id="left_column_inner"> 
        
        <h1>Contact Me:</h1>
              <p>Justin Kruse</p>
              <p>200 W. North Street</p>
              <p>Elida, Ohio 45807</p>
              <p>Home: 419-339-9229</p>
              <p>Cell: 419-979-9213</p>
                <br>
                <?php
                
    if ($success)
                    echo 
    '
                    <div style="color:#930;padding:10px;">
                        <strong>Thank you for contacting me, I will return your e-mail as soon as possible.</strong>
                    </div>'
    ;
                
    ?>
                <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="myform">
                    <div class="label">Name:</div>
                    <div class="cform">
                      <input type="text" name="Name" id="fname">
                    <?php
                    
    if ($err1)
                        echo 
    '<strong style="color:#930;" id="fname_err"> Please let me know who you are</strong>';
                    
    ?>
                  </div>
                    <div class="label">Email:</div>
                    <div class="cform">
                      <input type="text" name="Email" id="email">
                     <?php
                     
    if ($err2)
                        echo 
    '<strong style="color:#930;" id="email_err"> I need your email address too</strong>';
                    if (
    $err4
                        echo 
    '<strong style="color:#930;" id="email_err"> Your email address is invalid</strong>';
                    
    ?>
                      
                  </div>
                       <div class="label">Message:
                    <?php
                    
    if ($err3)
                        echo 
    '<strong style="color:#930;" id="message_err"> Please let me hear your thoughts</strong>';
                    
    ?>
                    </div>
                    <div class="cform"><br>
                        <textarea name="Message" id="message" rows="6" cols="50"></textarea>
                    </div>
                    <div class="submit">
                                
          <input type="submit" name="submit" value="Submit" class="submit-button">
                  </div>

                </form>
    </div> 
    </div> 
    <!--end left-column content--> 
     
     
     
    <!--begin right column--> 
     <div id="right_column"> 
     
        <div id="right_column_inner">Sample NewsSample NewsSample NewsSample NewsSample NewsSample NewsSample NewsSample News </div> 
         <div id="right_column_inner2"> 
         <p class="subheading">Heading</p> 
         
         <p> Sample TextSample TextSample TextSample TextSample TextSample TextSample TextSample TextSample TextSample TextSample Text </p> 
        
        </div> 
     </div> 
    <!--end right column--> 
     
    <!--begin footer--> 
     
     <div id="footer"> 
     
    <div id="footer_inner"><?php include('include/footer.php')?></div>
     
    </div> 
    <!--end footer--> 
     
    </div> 
    <!--end main wrapper--> 
     
     
     
    </body> 
     
    </html>
    Eric "PitbullMean" Melo
    Always Start your layout with*{border:0; margin:0; padding:0;}
    Be sure to Thank ALL Users who give assistance.

  • #2
    Regular Coder
    Join Date
    Oct 2007
    Location
    Glencoe, Ontario, Canada
    Posts
    340
    Thanks
    19
    Thanked 27 Times in 27 Posts
    I figured it out
    PHP Code:
    $message $_POST['message']; 
    needed to be
    PHP Code:
    $message $_POST['Message']; 
    Eric "PitbullMean" Melo
    Always Start your layout with*{border:0; margin:0; padding:0;}
    Be sure to Thank ALL Users who give assistance.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •