28 users online (1 members and 27 guests)  


  Results 1 to 15 of 15

Related

  1. read incoming mail and redirect to php script    Forum: CGI Perl Forum
    Replies: 2
  2. Problem with mail-script    Forum: PHP Forum
    Replies: 0
  3. Please Help Me - CGI Mail Form    Forum: CGI Perl Forum
    Replies: 1
  4. Php Mail script being Spammed    Forum: PHP Forum
    Replies: 7
  1. #1
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466

    php mail script help

    I've been tryin to code this feedback script by it's not workin, can you tell me the problem?

    <html>

    <head>

    <title>The "Feedback about your site" Form</title>

    </head>

    <body>

    <br>

    <table width="50%" border="0" align="center">
    <tr>
    <td>

    <p align="center">

    Give Me Some Feedback
    <br>
    Not only help out me but help out your fellow Webmasters by telling me how my site is doing.

    <form method=post action="mail.php">
    First name: <input type="text" size=30 name="FirstName"><br>
    Last name: <input type="text" size=30 name="LastName"><br>
    Your Email: <input type="text" size=30 name="Email">

    <br>
    <br>
    How are my tutorials?
    <br>
    <ul>
    <input type="radio" name="Gender" value=1>Very well written, I learned a lot from them.<br>
    <input type="radio" name="Gender" value=2>They're average, I learned quite a bit from them.<br>
    <input type="radio" name="Gender" value=3>Not very well done, I didn't learn too much.<br>
    <input type="radio" name="Gender" value=4>Not good at all, I learned nothing from them.<br>
    <input type="radio" name="Gender" value=5>Your site should be taken down immediately!<br>
    </ul>
    </p>
    <br>

    <p align="center">

    How is my site layout?
    <br>
    <ul>
    <input type="radio" name="Status" value=1>Excellent layout, I wish this was my site!<br>
    <input type="radio" name="Status" value=2>An average layout, but alright I guess.<br>
    <input type="radio" name="Status" value=3>I know millions sites with better layouts then yours!<br>
    <input type="radio" name="Status" value=4>Your site should be taken down immediately!<br>
    </ul>
    </p>
    <br>

    <p align="center">

    Anything you'd like to suggest about my site? Comments are welcome they can only do good!
    <br>
    <textarea name="Other" rows=6 cols=50></textarea>
    <input type="submit" name="Submit">

    </form>

    </p>

    </td>
    </tr>
    </table>

    <?php
    $formsent = mail("DerekPetersen1@hotmail.com", "Feedback About Your Site", "Request from: $LastName $FirstName\r\nMy tutorials are: $Gender\r\n\My site layout is: $Status\r\nSuggestions about my site: $Other", "From: $Email\r\nBounce-to: DerekPetersen1@hotmail.com");
    if($formsent == 1)
    {
    print("Thank you, $FirstName. Your feedback has been sent and his appreciated!");
    }
    else
    print("I'm sorry, there's a problem with your form. Please try again.");
    ?>
    </body>

    </html>

    Any help would be appreciated.

    Dave- How bout we make a php forum

  2. #2
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312

    Re: php mail script help

    Code:
    <?
    if($do_form != "yes") {
    ?>
    <html>
    
    <head>
    
    <title>The "Feedback about your site" Form</title>
    
    </head>
    
    <body>
    
    <br>
    
    <table width="50%" border="0" align="center">
    <tr>
    <td>
    
    <p align="center">
    
    Give Me Some Feedback
    <br>
    Not only help out me but help out your fellow Webmasters by telling me how my site is doing.
    
    <form method=post action="mail.php">
    <input type="hidden" name="do_form" value="yes">
    First name: <input type="text" size=30 name="FirstName"><br>
    Last name: <input type="text" size=30 name="LastName"><br>
    Your Email: <input type="text" size=30 name="Email">
    
    <br>
    <br>
    How are my tutorials?
    <br>
    <ul>
    <input type="radio" name="Gender" value=1>Very well written, I learned a lot from them.<br>
    <input type="radio" name="Gender" value=2>They're average, I learned quite a bit from them.<br>
    <input type="radio" name="Gender" value=3>Not very well done, I didn't learn too much.<br>
    <input type="radio" name="Gender" value=4>Not good at all, I learned nothing from them.<br>
    <input type="radio" name="Gender" value=5>Your site should be taken down immediately!<br>
    </ul>
    </p>
    <br>
    
    <p align="center">
    
    How is my site layout?
    <br>
    <ul>
    <input type="radio" name="Status" value=1>Excellent layout, I wish this was my site!<br>
    <input type="radio" name="Status" value=2>An average layout, but alright I guess.<br>
    <input type="radio" name="Status" value=3>I know millions sites with better layouts then yours!<br>
    <input type="radio" name="Status" value=4>Your site should be taken down immediately!<br>
    </ul>
    </p>
    <br>
    
    <p align="center">
    
    Anything you'd like to suggest about my site? Comments are welcome they can only do good!
    <br>
    <textarea name="Other" rows=6 cols=50></textarea>
    <input type="submit" name="Submit">
    
    </form>
    
    </p>
    
    </td>
    </tr>
    </table>
    
    <?php
    } else {
    $formsent = mail("DerekPetersen1@hotmail.com", "Feedback About Your Site", "Request from: $LastName $FirstName\r\nMy tutorials are: $Gender\r\n\My site layout is: $Status\r\nSuggestions about my site: $Other", "From: $Email\r\nBounce-to: DerekPetersen1@hotmail.com");
    if($formsent == 1)
    {
    print("Thank you, $FirstName. Your feedback has been sent and his appreciated!");
    }
    else
    print("I'm sorry, there's a problem with your form. Please try again.");
    }
    ?>
    </body>
    
    </html>
    There you go, that should be correct :)

  3. #3
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    Just so you know what I did,

    I added a hidden variable to your form, called "do_form"

    Now, whent he form is sent, I tell $do_form to be "yes".. The little if/else statement that starts at the top, says that if $do_form isn't set to yes, it will display the form, otherwise, it will do the form for you

    Easy enough I think, and Dave should add a PHP forum, I agree

  4. #4
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466

    thanks zaire

    k, I got it to at least submit and go to a different page, but it automatically, even if everything is filled out, says "Warning: Unknown error in c:\foxserv\www\mail.php on line 76
    I'm sorry, there's a problem with your form. Please try again."

    Line 76, in otherwords, is the

    $formsent = mail("DerekPetersen1@hotmail.com", "Feedback About Your Site", "Request from: $LastName $FirstName\r\nMy tutorials are: $Gender\r\n\My site layout is: $Status\r\nSuggestions about my site: $Other", "From: $Email\r\nBounce-to: DerekPetersen1@hotmail.com");

    part. It always shows the "else" statement. Anything to be done?

  5. #5
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    I would double check your mail() function, it might not be totaly correct...


    http://home.zaireweb.com/NET/quickref.php?f=s&pattern=mail

    Or, the "easier" version of mail() @
    http://php.net/mail

  6. #6
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466

    hmm...

    newsgroups, stuff like that, all such a hassle...

    I know if we worked one on one, webmaster-webmaster, we could get this script working...
    I can't find anything wrong, I was wondering if u just had some similar mail script on the back burner?

  7. #7
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    Yep, but im going to bed

    Ill post it for you tommorrow.

    And what is this about newsgroups? I gave you 2 links to php manuals, my quickreference one, and php.net's full manual

    -Eric

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    try...

    Uploading the script and trying it on a real web server.

    The mail function is pretty tricky to get working @ home.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  9. #9
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312

    Re: try...

    Originally posted by QuietDean
    Uploading the script and trying it on a real web server.

    The mail function is pretty tricky to get working @ home.
    Wow, Thanks Dean.. The fact that he was usin' foxserv totaly slipped by me..... Guess that's what happens when you don't pay attention.... Try Dean's Suggestion

  10. #10
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466

    I'm tired but I'll upload it tomorrow...

    it's not that the manual and stuff was all good, it's just for a certain script and getting real time help, a manual can't do that half the time thanks for ur time guys.

  11. #11
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    No worries, Z. One line in about 400, there..

    Also, it's the lazy answer because I couldn't face reading through the mail script, lol.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  12. #12
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466

    forgot about uploadin it...

    I just did...no matter what I do it still comes up with the "I'm sorry there's a problem with your form" thing. Online it only says that. Offline it says that and right above that is says "error on line 76". Any more suggestions?

  13. #13
    Zaire's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Mar 2001
    Location
    Hamburg, NY
    Posts
    312
    First off, try changing this:
    Code:
    <?php
    } else {
    $formsent = mail("DerekPetersen1@hotmail.com", "Feedback About Your Site", "Request from: $LastName $FirstName\r\nMy tutorials are: $Gender\r\n\My site layout is: $Status\r\nSuggestions about my site: $Other", "From: $Email\r\nBounce-to: DerekPetersen1@hotmail.com");
    if($formsent == 1)
    {
    print("Thank you, $FirstName. Your feedback has been sent and his appreciated!");
    }
    else
    print("I'm sorry, there's a problem with your form. Please try again.");
    }
    ?>
    to this:
    Code:
    <?php
    } else {
    $formsent = mail("DerekPetersen1@hotmail.com", "Feedback About Your Site", "Request from: $LastName $FirstName\r\nMy tutorials are: $Gender\r\n\My site layout is: $Status\r\nSuggestions about my site: $Other", "From: $Email\r\nBounce-to: DerekPetersen1@hotmail.com");
    if($formsent == 1)
    {
    print("Thank you, $FirstName. Your feedback has been sent and his appreciated!");
    }
    else
    print("I'm sorry, there's a problem with your form. Please try again.");
    }
    }
    ?>
    I added an extra '}' on the end, to close your other if/else statement. if that doesnt work, try this

    Code:
    <?php
    } else {
    mail("DerekPetersen1@hotmail.com", "Feedback About Your Site", "Request from: $LastName $FirstName\r\nMy tutorials are: $Gender\r\n\My site layout is: $Status\r\nSuggestions about my site: $Other", "From: $Email\r\nBounce-to: DerekPetersen1@hotmail.com");
    print("Thank you, $FirstName. Your feedback has been sent and his appreciated!");
    }
    ?>
    That just display's thanks to the user no matter what. If you get the email, you know it works

  14. #14
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466

    hmm...

    this still aint workin...it acts all like it will work but then the e-mail never sends (when uploaded on the i-net) and when on foxserv it says there's an error with the
    mail("blahblah"); line. This is very frustratin been trin a bunch of different stuff btu still no success.

  15. #15
    jimchud's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2003
    Posts
    1
    ok im also sort of having a simular problem in respects to the fact that im working on an intranet site..
    and what i need to do is set the values of what the smtp server i want to use are....

    quoting the php.net site..


    --------------------
    Runtime Configuration
    The behaviour of these functions is affected by settings in php.ini.


    Table 1. Mail configuration options

    Name Default Changeable
    SMTP "localhost" PHP_INI_ALL
    smtp_port "25" PHP_INI_ALL
    sendmail_from NULL PHP_INI_ALL
    sendmail_path DEFAULT_SENDMAIL_PATH PHP_INI_SYSTEM

    For further details and definition of the PHP_INI_* constants see ini_set().

    Here's a short explanation of the configuration directives.

    ------------------------


    i want to have it not so that i have to change the php coz i will be having variable scripts from variable emails addresses and also other pages etc..

    so what i wanted to do was have a php script that held the info so that it could refer to a external smtp server......

    i know its possible as phpbb2 forums use it.. im just not sure how complex it would have to be and what i would have to do to go about it..

    as i think its possible but im not very good at php at all...
    im a noobie at it.. so im jus gettin on to the ropes and trying to climb...
    any help would be greatly appreciated..

    regards
    jim



Tags for this Thread