SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mail form with flash template

    Hello, I'm new to flash. I purchased a flash template and I'm trying to get the mail form working. On the mail form page, there is a submit button. Here is the action behind the button:
    on (release) {
    _parent.getURL("contact.php","_blank","GET");
    _parent.name="Your name:";
    _parent.email="E-Mail:";
    _parent.message="Message:";
    }

    Here is the contact.php file:
    <?php

    $your_name = $_GET['name'];
    $your_email = $_GET['email'];
    $your_message = $_GET['message'];

    $recipient="greg@mydomain.com";


    $headers .= 'Content-type: text/html; charset=iso-8859-1';

    $content = "<html><head><title>Contact letter</title></head><body><br>";
    $content .= "Name: <b>" . $your_name . "</b><br>";
    $content .= "E-mail: <b>" . $your_email . "</b><br><hr><br>";
    $content .= $your_message;
    $content .= "<br></body></html>";

    mail($recipient,$subject,$content,$headers);
    ?>
    <html>
    <body bgcolor="#282E2C">
    <div align="center" style="margin-top:60px;color:#FFFFFF;font-size:11px;font-family:Tahoma;font-weight:bold">
    Your message was sent. Thank you.
    </div>
    </body>
    </html>
    <script>resizeTo(300, 300)</script>

    After completing the form, and clicking on the submit button, it gives me the option to open a file, it ends up opening the the contact.php file within dreamweaver.

    Thank you in advance!!

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,559
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    That's because you're not executing the php file (as it's not on a web server).

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish it was that simple. I have both programs residing on my web server. I've confirmed that my web hosting company has php enabled.

  4. #4
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,559
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    You have a relative url in the flash file:
    _parent.getURL("contact.php","_blank","GET");

    If you preview the form locally from within dreamweaver, the getURL is looking relative to the embedding html files location i.e : your hard drive file location, not the web url.

    If you are previewing the web page live on the web and this is happening, what happens if you directly browse the contact.php url? It'd be very easy to test whether php is enabled: upload a file e.g test.php with
    <?php echo('hello'); ?> and see what happens.

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did what you recommended, and I'm getting similar results. It brings up the file download window with the options of open, save, cancel. If I select open, it launches Dreamweaver with the test.php file opened.

  6. #6
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hold off, I believe my problem is my web hosting. Let me find out from them before you do any work.

  7. #7
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My hosting plan did not include PHP. I've changed plans and now I'm set to go.

    I first checked to make sure that "test.php" worked correctly. It did. I then opened my flash file, filled in the information on the form, and clicked on submit. It looks like it worked properly, but I did not receive the email it was suppose to send. The message that "your message has been sent" was displayed on the screen. Where do you recommend I start looking?

  8. #8
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,559
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Try this: create a new test.php with the following content, upload and then load the URL in the browser directly.

    PHP Code:
    <?php
    error_reporting
    (E_ALL);
    if(
    mail("youremail@yourdomain","This is the test subject","This is a test message"))
    {
        echo(
    "mail sent");
    }
    else
    {
        echo(
    "mail NOT sent");
    }
    ?>

  9. #9
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I changed the "test.php" per your recommendations. This is what is displayed when I execute "test."


    Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in D:\Inetpub\e-byz\test.php on line 3
    mail NOT sent

    I think I know what this means, but I'll wait for your assistance

  10. #10
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,559
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Try either inserting this after line 2
    PHP Code:
    ini_set("sendmail_from","youremail@yourdomain.com"); 
    or

    replacing the line

    Code:
    mail("youremail@yourdomain","This is the test subject","This is a test message","From:myemail@mydomain.com\r\n");
    beyond that I'd probably repost in the php forum as it's more relevant to the audience there.


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
  •