Skip to main content
April 17, 2009
Question

Email Handling PHP

  • April 17, 2009
  • 3 replies
  • 811 views

Hi,

I had such awesome help the last time I posted I have no doubt that someone can help me here. I tried a tutorial on creating an email form and sending the data by php. I followed everything he did on the video and posted the form and php on my server to test. I worked for the most part when I entered the information for the form and sent it, it displayed a response back the the email went through, it showed up in my email box but the From field in the display didn't look correct plus it didn't display the information in the fields. I'm going to include a screen shot of the email and the code below. Hopefully someone can help. Thanks.

Don

<?php

/* Subject and Email Variables */

    $emailSubject = 'Crazy PHP Scripting';
    $webMaster = 'dggrafix@earthlink.net';
   
   
/* Gathering data Variables */

    $emailField = $_POST['email'];
    $nameField = $_POST['name'];
    $phoneField = $_POST['phone'];
    $budgetField = $_POST['budget'];
    $travelersField = $_POST['travelers'];
    $commentsField = $_POST['comments'];
    $newsletterField = $_POST['newsletter'];
   
    $body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Phone Number: $phone <br>
Budget: $budget <br>
Number of Travelers: $travelers <br>
Comments: $comments <br>
Newsletter: $newsletter <br>
EOD;

    $headers = "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);
   
/* Results rendered as HTML */

    $theResults = <<<EOD
<html>
<head>
<title>JakesWorks - travel made easy-Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
    background-color: #f1f1f1;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #666666;
    text-decoration: none;
}
-->
</style>
</head>

<div>
  <div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";

?>

This topic has been closed for replies.

3 replies

Inspiring
April 17, 2009

Hi csgdon: Would you be able to tell me how or if I can access the instructional video you had mentioned. I'd like to see it. Thank-you, MLR

April 17, 2009

Hey MLR, you can go to www.tutvid.com, Lee Brimelow is his name. I really like his tutorials but you know how it is even foloowing them word for word your project doesn't seem to come out the way there's does. LOL.

I might as well put it out while I'm writing. I'm having problems linking my Submit button on my form. Here is my code:

stop();
var getPHP:URLRequest = new URLRequest("http://www.dggrafix.com/glutenfree2/contactformprocess.php");

    submit_btn.addEventListener(MouseEvent.CLICK, formClick);

function formClick(event:MouseEvent):void{
    navigateToURL(getPHP);
}

I put this code on the timeline of the form. Correct me if I'm wrong the submit button just needs to link to your PHP file on your server. I'm getting back a #1009 error Cannot access a property or method of a null object reference. I tried referencing the movie file that the button is in ie: form.submit_btn, still get and error. Can anyone shed some light. Thanks.

csgdon

Inspiring
April 17, 2009

Hi csgdon: Thank-you for the URL to the instructional video. I am at an earlier stage of the procedure you are achieving. Incase this helps, here is a link to an recommended article. Maybe it will contain the code you are looking for. I hope someone can give you a more direct answer, good luck. MLR - - -

http://www.thetechlabs.com/interfaces/how-to-create-a-simple-flashphp-mail-contact-form-with-as3-and-mysql/

kglad
Community Expert
Community Expert
April 17, 2009

remove the Field part of all the variable names in your gathering data section.

April 17, 2009

Again, I am not disappointed by the knowledgable people I'm coming across. Thanks A lot!! Kglad, that fixed the issue right up, not sure why he would he would say to do that in the video. Thanks again!

csgdon

kglad
Community Expert
Community Expert
April 17, 2009

you're welcome.

April 17, 2009

Also, not sure if maybe it has something to do on the server side. Thanks.

Don