A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Easy PHP Question

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    3

    Easy PHP Question

    I have a submission form on my website written in flash. I want to use a php script, hosted on my ftp, to send the info inputted in the form to my email. Only problem is nothing gets sent when I hit submit. Can someone take a look at my php and tell me where I'm going wrong?
    Everything is exactly how I have it on my ftp except for the email I have blocked out.


    <?php

    $FirstName = $_REQUEST["FirstName"];
    $LastName = $_REQUEST["LastName"];
    $Age = $_REQUEST["Age"];
    $Phone = $_REQUEST["Phone"];
    $Email = $_REQUEST["Email"];
    $Zip = $_REQUEST["Zip"];
    $Background = $_REQUEST["Background"];
    $DatesTimes = $_REQUEST["DatesTimes"];

    $full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message;
    $message= $full_message;

    if(isset($FirstName) and isset($LastName) and isset($Age) and isset($Phone) and isset($Email) and isset($Zip) and isset($Background) and isset($DatesTimes)){
    mail("xx@example.com", $FirstName, $LastName, $Age, $Phone, $Email, $Zip, $Background, $DatesTimes, "From: $sender");
    }?>

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    the format of mail() is
    mail(address, subject, message)

    So you would put all the interesting fields together like
    Code:
    $message = "$Firstname $Lastname\nAge: $Age\nPhone: $Phone\nEmail: $Email\n\nsent this message:\n$message";
    and use that in the mail() call

    BTW: your code does not show an incoming field where the $message is taken from, there should be another
    Code:
    $message = $_REQUEST[...];
    line

    Musicman

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    3
    so based on your guidance this is what i came up with... is this correct? can you amend it if it is not? it is still not working on my site.

    <?php

    $message = "$FirstName\nLastName: $LastName\nAge: $Age\nPhone: $Phone\nEmail: $Email\n\nsent this message:\n$message";

    $message = wordwrap($message, 70);

    mail('craig@nelsonpiano.com', 'New Student', $message);


    $full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message;
    $message= $full_message;

    ?>

  4. #4
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    at first glance this looks ok. Do you have actual website to look at?

    The two lines at the end are somewhat misplaced - if you want them to work, you should move them before the mail() line. However, they would not cause the script to fail

    Musicman

  5. #5
    Junior Member
    Join Date
    Jul 2011
    Posts
    3
    Musicman,

    I sent you a pm but I'm not sure if it went through. Can you pm me your personal email so I can send you the fla file and you can take a look at the code? I've been trying to get this form to work for more than a month and I am very frustrated. If you could help me out I'd really appreciate it. Thanks.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center