Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Beginner needs help with email form

    I created an email form for my fiance and his friends' website, SeriouslyGuys <http://www.seriouslyguys.com>

    When I test the form on my server, it works perfectly.

    I put the form on the SeriouslyGuys server, and it doesn't deliver emails to my inbox. Both sites are hosted via GoDaddy, both on Linux machines, both with full PHP abilities.

    Below is what the form looks like...its not pretty, but it serves its purpose.

    If you want to test it out for your own reasons, please select "Julie Brennan" as the person you are emailing...I do not want to bug the others with junk mail please.

    Working form: http://www.julie-brennan.com/misc/emailSG.php

    Non-working form: http://www.seriouslyguys.com/emailSG.php

    Thanks in advance!

    Code:
    <html>
    
    
    
    <title>E-mail SeriouslyGuys</title>
    
    
    
    <body>
    
    <center>
    
    <form action="" method="post">
    
    Who do you want to Contact? <br>
    
    <select name="emailto">
    <option value="chris.taylor@seriouslyguys.com">Chris "Chugs" Taylor</option>
    <option value="rick.snee@seriouslyguys.com">Rick Snee</option>
    <option value="bryan.mcbournie@seriouslyguys.com">Bryan McBournie</option>
    <option value="bryan.schools@seriouslyguys.com">Bryan Schools</option>
    <option value="julie.brennan@seriouslyguys.com">Julie Brennan</option>
    </select> <br>
    
    Your Name: <br>
    
    <input size="30" type="text" name="name">
    
    <br>
    
    Your E-mail: <br>
    
    <input size="30" type="text" name="email">
    
    <br>
    
    Subject: <br>
    
    <input size="30" type="text" name="subject">
    
    <br>
    
    Message:<br>
    
    <textarea name="message" cols="25" rows="5"></textarea><br>
    
    <input type="submit" name="submit" value="Send">
    
    <input type="reset" name="Reset" value="Reset">
    
    </form>
    
    
    
    
    
    <?php
    
    if ($submit) { // if the form was sent do the following
    
    
    
    if($emailto && $name && $subject && $email && $message ) { // if all fields were filled-in send email
    
    mail("$emailto","$subject","$message","From: $name, $email") or die("email error");
    
    echo "Message Sent"; // if all went well, display message was sent
    
    } else {
    
    echo "All fields must be filled in!"; // if not all were filled in, display error message
    
    }
    
    } // end php submission code
    
    ?>
    
    </center>
    
    </body>
    Last edited by jabrennan; 01-16-2008 at 04:34 AM. Reason: update

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    They both worked identically for me. You may want to explicitly set the form action tho.

    PHP Code:
    <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #3
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    i tried submitting the empty form and even the error message is not echoed in http://www.seriouslyguys.com/emailSG.php

    since ur referring to the post vars as simply $submit i'm assuming ur using import_request_variables i think register_globals is on on or some such error

    take a look here http://php.net/manual/en/function.im...-variables.php
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #4
    New Coder
    Join Date
    Dec 2007
    Posts
    68
    Thanks
    25
    Thanked 2 Times in 2 Posts
    I think adding extract() command like the one below will solve your problem...
    extract($POST);
    if ($submit) { ...

    or

    extract($HTTP_POST_VARS);
    if($submit){...

  • #5
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks kairog...adding

    extract($HTTP_POST_VARS);

    made it work perfectly.

    Thanks to everyone who gave feedback, I really appreciate it!

  • #6
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Is Go Daddy using PHP < 4.1?
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.


  •  

    Posting Permissions

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