Jump to content

PHP contact form not sending email


liget

Recommended Posts

Hey guys I am having a problem getting my php form to work. I thought this code was simple, but I guess not. It will not return an email back to the email address I have put in.  I am calling the form from a flash movie.  The form will generate a “message sent” statement in my movie. The server it is hosted on is running php version 5.  I have validated my php code in dreamweaver and get no errors or warnings. I am by far no expert at php, and hope some of you guys could help me out.  I did use swish to make this site if that helps any. I am going to post my code to call the php contact form, and the php contact form code.  Ohhh yeah.....the form is saved in the right directory also.  Here is the code. 

 

Code in flash movie:

 

on (rollOver) {

    gotoAndPlay("on");

}

on (rollOut) {

    gotoAndPlay("off");

}

on (release) {

    if (!_parent.Name.length) {

        _parent.Status = "Name Required";

    } else {

        if (!_parent.Email.length || _parent.Email.indexOf("@") == -1 || _parent.Email.indexOf(".") == -1) {

            _parent.Status = "Valid Email Required";

        } else {

            if (!_parent.Message.length) {

                _parent.Status = "Message Required";

            } else {

                _parent.Status = "";

                name = _parent.name;

                email = _parent.email;

                phone = _parent.phone;

                message = _parent.message;

                loadVariablesNum("Mail_Form.php",0,'POST');

                _parent.gotoAndPlay("submitted");

            }

        }

    }

}

 

Here is the php code:

 

<?php

 

$name = $HTTP_POST_VARS['name'];

$email = $HTTP_POST_VARS['email'];

$phone = $HTTP_POST_VARS['phone'];

$message = $HTTP_POST_VARS['message'];

 

$name = stripslashes($name);

$email = stripslashes($email);

$phone = stripslashes($phone);

$message = stripslashes($message);

 

$rec_email = "[email protected]";

$subject = "Web Page Contact Form";

 

$msg_body .= "Name:  $name\n";

$msg_body .= "Phone Number:  $phone\n";

$msg_body .= "E-Mail:  $email\n";

$msg_body .= "Message:  $message\n";

$msg_body .= "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n";

 

$header_info = "From: ".$name." <".$email.">";

 

mail($rec_email, $subject, $msg_body, $header_info);

 

?>

Thanks everybody!!!!!!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/138843-php-contact-form-not-sending-email/
Share on other sites

I am not sure if $HTTP_POST_VARS is flat out gone in PHP5, but I do know that it is deprecated and you should use

$_POST[]

or

$_GET[]

instead.

 

Change the

$HTTP_POST_VARS

to

$_POST

and echo out the vars to ensure that your variables contain the data you expect.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.