Grow your CSS skills. Land your dream job.

My contact form doesnt work

  • # April 5, 2009 at 2:38 pm

    Hi there,

    I have been looking on the internet to fix my lil problem i have with my contact form. But i doesnt seem to find the answer for it. Thats why i am going to bothering you guys here and hope you dont mind and help me out with this problem which is really small for most of you but for me its a disaster.

    My problem is as follow:
    I have a contact form in HTML when press submit it use PHP script to mail to me.
    But when error or succes it redirect to a specific page. But unfortunately i cant get this to work.

    Below is the form n HTML

    Code:








    And here is the PHP script

    Code:
    < ?php

    // get posted data into local variables
    $EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
    $EmailTo = "wing72@gmail.com";
    $Subject = "Mail vanuit website";
    $name = Trim(stripslashes($_POST['name']));
    $company = Trim(stripslashes($_POST['company']));
    $tel = Trim(stripslashes($_POST['tel']));
    $email = Trim(stripslashes($_POST['email']));
    $message = Trim(stripslashes($_POST['message']));

    // validation
    $validationOK=true;
    if (Trim($EmailFrom)=="") $validationOK=false;
    if (!$validationOK) {
    print "“;
    exit;
    }

    // prepare email body text
    $Body = “”;
    $Body .= “name: “;
    $Body .= $name;
    $Body .= “n”;
    $Body .= “company: “;
    $Body .= $company;
    $Body .= “n”;
    $Body .= “tel: “;
    $Body .= $tel;
    $Body .= “n”;
    $Body .= “email: “;
    $Body .= $email;
    $Body .= “n”;
    $Body .= “message: “;
    $Body .= $message;
    $Body .= “n”;

    // send email
    $success = mail($EmailTo, $Subject, $Body, “From: < $EmailFrom>“);

    // redirect to success page
    if ($success){
    print ““;
    }
    else{
    print ““;
    }
    ?>

    I hope you guys can help me out,

    Thanks Alot for your time

    # April 6, 2009 at 3:28 pm

    Is there anyone who can help me out with this bit pls ..

    # April 6, 2009 at 3:39 pm

    Not sure what you are asking.
    The whole thing doesn’t work or just the page redirect?

    # April 6, 2009 at 5:42 pm

    thnx for you time, well its the whole thing that doesnt work.
    It doesnt send any mail out and it keep redirecting to the error page not matter what.

    wing

    # April 6, 2009 at 6:26 pm

    doing a basic test can help see where it is dying, like at each stage, write something out to the page:
    e.g. if your php filled the body of the mail, echo it out, perform something for each stage to see when it dies…
    echo = "body populated";

    "wingye" wrote:
    thnx for you time, well its the whole thing that doesnt work.
    It doesnt send any mail out and it keep redirecting to the error page not matter what.

    wing

    are you on a windows server?
    if so you need to set your ini in php

    plus enquiry & message are not the same!!! you might want to change one.

    mind you it looks like the script I use, but I $_REQUEST my HTML elements

    e.g.

    Code:
    $name = $_REQUEST['name'];
    $tel = $_REQUEST['tel'];
    $email = $_REQUEST['email'];

    also this is my success:
    $success = mail($EmailTo, $Subject, $Body, "From: <$email>", "-froot@my-email-address");

    hopefully these small hints may help get it working

    # May 11, 2009 at 11:00 am

    Maybe I can help you with your problem. I have written an article on my blog on creating a contact form using PHP and jQuery for validation. It’s really simple and short. I hope you will find my article helpful. Thank you.

    http://www.raymondselda.com/php-contact … alidation/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".