SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    636
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Contact Form Not Working

    Hello,

    This says its working but I dont see it when I check my email it shows new email but when I open it doesnt show the name, email or message.

    http://godfatherrecords.com

    Any ideas what I did wrong?

    Thanks,

    Mike

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,112
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    You'll need to show the code you are using to process the form.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    636
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Here is the php for the contactengine.php...

    Code:
    <?php
    
    $EmailFrom = $_POST['email'];
    $EmailTo = "info@godfatherrecords.com";
    $Subject = "Godfather Records Email Form";
    $name = Trim(stripslashes($_POST['Name'])); 
    $email = Trim(stripslashes($_POST['Email'])); 
    $comments = Trim(stripslashes($_POST['Message'])); 
    
    // validation
    $validationOK=true;
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
      exit;
    }
    
    // prepare email body text
    $Body = "";
    $Body .= "Name: ";
    $Body .= $name;
    $Body .= "\n";
    $Body .= "Email: ";
    $Body .= $email;
    $Body .= "\n";
    $Body .= "Message: ";
    $Body .= $comments;
    $Body .= "\n";
    
    // send email 
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    
    // redirect to success page 
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,069
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Check the name of your form fields and make sure these are correct:
    PHP Code:
    $name Trim(stripslashes($_POST['Name'])); 
    $email Trim(stripslashes($_POST['Email'])); 
    $comments Trim(stripslashes($_POST['Message'])); 
    From what I can tell, it should be
    PHP Code:
    $name Trim(stripslashes($_POST['name'])); 
    $email Trim(stripslashes($_POST['email'])); 
    $comments Trim(stripslashes($_POST['comments'])); 
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,112
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by cpradio View Post
    From what I can tell, it should be ... $_POST['name'] ...
    Yes, it's better never to use capitals in code (except perhaps when camel casing), as it's just one extra way to get things messed up.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  6. #6
    SitePoint Member
    Join Date
    Nov 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Yes, it's better never to use capitals in code (except perhaps when camel casing), as it's just one extra way to get things messed up.
    And I believe it's better to use underscore to divide variable name than using camel casing. It describe the variable better.
    But of course it's up to the programmer's style.


Bookmarks

Posting Permissions

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