FeedBack Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nickyspace
    New Member
    • Mar 2008
    • 14

    FeedBack Form

    i have a code wherein it is asking email id and message from the user in the form named as feedback.html
    HTML CODE AS BELOW[php]<html>
    <body>
    <form method="post" action="sendmai l.php">
    Email: <input name="email" type="text" size="20" /><br />
    Message:<br />
    <textarea name="message" rows="15" cols="40">
    </textarea><br />
    <input type="submit" />
    </form>
    </body>
    </html>[/php]THE ABOVE HTML CODE CALLS sendmail.php . wherein this accepts the emailid and message variable in php and sends mail.
    PHP CODE AS BELOW[php]<?php
    $email = $_REQUEST['email'] ;
    $message = $_REQUEST['message'] ;

    mail( "yourexample@ex ample.com", "Feedback Form Results",
    $message, "From: $email" );
    header( "Location: http://www.yoursite.co m/thanks.php" );
    ?>[/php]

    in the above code yourexample@exa mple.com was my email address.
    http://www.yoursite.com/thanks.php was having my clients site .

    but the error is i havent recd any mail i my mailbox

    anyone can help me please regarding this issue
    Last edited by ronverdonk; Apr 9 '08, 08:36 AM. Reason: code tags!!
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Try use POST instead of REQUEST in your php form.

    Also use the correct code tags when you post code in these forums!

    Comment

    • nickyspace
      New Member
      • Mar 2008
      • 14

      #3
      Originally posted by TheServant
      Try use POST instead of REQUEST in your php form.

      Also use the correct code tags when you post code in these forums!
      hi

      TheServant

      thanks for replying .

      but may i knw where did i made mistake in code tags.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Please enclose your posted code in [code] tags (See How to Ask a Question).

        This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

        Please use [code] tags in future.

        MODERATOR

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Usually in programming you check results from commands. You have not done that.

          So first check the result of the mail() function, print that and, when your mail is successfully sent without errors, and it does not arrive, look at the existence of the receiving mailbox.

          Then come back.

          Ronald

          Comment

          • nickyspace
            New Member
            • Mar 2008
            • 14

            #6
            Originally posted by ronverdonk
            Usually in programming you check results from commands. You have not done that.

            So first check the result of the mail() function, print that and, when your mail is successfully sent without errors, and it does not arrive, look at the existence of the receiving mailbox.

            Then come back.

            Ronald
            i have tried to print the mail() . it has printed as 1. can you plz tell me what does 1 means in php for mail function

            Comment

            • TheServant
              Recognized Expert Top Contributor
              • Feb 2008
              • 1168

              #7
              Originally posted by nickyspace
              i have tried to print the mail() . it has printed as 1. can you plz tell me what does 1 means in php for mail function
              I am not sure, but 1 means true. So I am guessing that that means it sent the mail (provided you filled in the fields required).

              Your mail() function should be like this tutorial. Have you tried to send it to your address? Did it come through?

              Comment

              • nickyspace
                New Member
                • Mar 2008
                • 14

                #8
                Originally posted by TheServant
                I am not sure, but 1 means true. So I am guessing that that means it sent the mail (provided you filled in the fields required).

                Your mail() function should be like this tutorial. Have you tried to send it to your address? Did it come through?
                HI

                thanks for always replying my mails , i'm really sorry for you again and again bothering for mail() .
                i have gone through tutorials and used the phpmail code but i still didnt received any of the mails in my mail account.


                The below code as follow[php]<html>
                <body>
                <?php
                if (isset($_REQUES T['email']))
                //if "email" is filled out, send email
                {
                //send email
                $email = $_REQUEST['email'] ;
                $subject = $_REQUEST['subject'] ;
                $message = $_REQUEST['message'] ;
                mail( "myemailid@exam ple.com", "Subject: $subject",
                $message, "From: $email" );
                echo "Thank you for using our mail form";
                echo $email.$subject .$message;
                }
                else
                //if "email" is not filled out, display the form
                {
                echo "<form method='post' action='feedbac k.php'>
                Email: <input name='email' type='text' /><br />
                Subject: <input name='subject' type='text' /><br />
                Message:<br />
                <textarea name='message' rows='15' cols='40'>
                </textarea><br />
                <input type='submit' />
                </form>";
                } ?>
                </body>
                </html>[/php]
                help me regarding this code . b'coz using this code i still can't receive any mails in my mail box

                if there is any wrong in code tag .i'm really sorry for that.
                Last edited by ronverdonk; Apr 10 '08, 09:18 PM. Reason: 2nd warning: use code tags!

                Comment

                • TheServant
                  Recognized Expert Top Contributor
                  • Feb 2008
                  • 1168

                  #9
                  Your form submission method has been changed to what I recommended, but your variables called by php ($email, $subject, $message) are still coming from a request ($_REQUEST['email'], $_REQUEST['subject'], $_REQUEST['message']).

                  You need to change your code to:
                  [PHP]$email = $_POST['email'] ;
                  $subject = $_POST['subject'] ;
                  $message = $_POST['message'] ;[/PHP]

                  Then it should work...

                  Comment

                  • nickyspace
                    New Member
                    • Mar 2008
                    • 14

                    #10
                    Originally posted by TheServant
                    Your form submission method has been changed to what I recommended, but your variables called by php ($email, $subject, $message) are still coming from a request ($_REQUEST['email'], $_REQUEST['subject'], $_REQUEST['message']).

                    You need to change your code to:
                    [PHP]$email = $_POST['email'] ;
                    $subject = $_POST['subject'] ;
                    $message = $_POST['message'] ;[/PHP]

                    Then it should work...
                    hi
                    the servant

                    i'm really sorry but it still not working
                    i have changed from [php]
                    $email = $_REQUEST['email'];
                    $subject = $_REQUEST['subject'];
                    $message = $_REQUEST['message'];[/php]to[php]
                    $email = $_POST['email'] ;
                    $subject = $_POST['subject'] ;
                    $message = $_POST['message'] ;[/php]But it is still not working . I'm really upset why its not working because my module is getting delayed.
                    Last edited by ronverdonk; Apr 11 '08, 10:02 AM. Reason: code tags!!

                    Comment

                    • TheServant
                      Recognized Expert Top Contributor
                      • Feb 2008
                      • 1168

                      #11
                      Sorry did you also change isset($_REQUEST['email']) to isset($_POST['email'])?

                      After looking at that link I gave you, they use REQUEST, so not 100% sure you can't do that... I only use POST though...

                      So are you getting an error, or is the email just not coming through?

                      Comment

                      • nickyspace
                        New Member
                        • Mar 2008
                        • 14

                        #12
                        Originally posted by TheServant
                        Sorry did you also change isset($_REQUEST['email']) to isset($_POST['email'])?

                        After looking at that link I gave you, they use REQUEST, so not 100% sure you can't do that... I only use POST though...

                        So are you getting an error, or is the email just not coming through?
                        hi

                        The servant

                        i'm really very thankful to u for answering my query . but i'm very sad after making changes from REQUEST to POST the mail is still not working.

                        could you plz give any other alternative or any link where i can findout the way to overcome from phpmail

                        Comment

                        • nickyspace
                          New Member
                          • Mar 2008
                          • 14

                          #13
                          hi
                          the servant


                          thanxs for all ur help.

                          i have resolved my issue.

                          warm regards
                          priti

                          Comment

                          • dlite922
                            Recognized Expert Top Contributor
                            • Dec 2007
                            • 1586

                            #14
                            Originally posted by TheServant
                            Your form submission method has been changed to what I recommended, but your variables called by php ($email, $subject, $message) are still coming from a request ($_REQUEST['email'], $_REQUEST['subject'], $_REQUEST['message']).

                            You need to change your code to:
                            [PHP]$email = $_POST['email'] ;
                            $subject = $_POST['subject'] ;
                            $message = $_POST['message'] ;[/PHP]

                            Then it should work...
                            Why don't you like $_REQUEST()?

                            it basically just tries to get the vars from $_GET[], $_COOKIE[], and $_POST[] anyway.

                            not in that order though.

                            You insisted so much on something not relative.

                            How about asking if he's got PHP.INI configured to send mail and SMTP points to a valid SMTP server that sends mail.

                            peace out,

                            DM

                            Comment

                            • TheServant
                              Recognized Expert Top Contributor
                              • Feb 2008
                              • 1168

                              #15
                              Originally posted by nickyspace
                              hi
                              the servant


                              thanxs for all ur help.

                              i have resolved my issue.

                              warm regards
                              priti

                              No worries mate.

                              Originally posted by dlite922
                              Why don't you like $_REQUEST()?

                              it basically just tries to get the vars from $_GET[], $_COOKIE[], and $_POST[] anyway.

                              not in that order though.

                              You insisted so much on something not relative.

                              How about asking if he's got PHP.INI configured to send mail and SMTP points to a valid SMTP server that sends mail.

                              peace out,

                              DM
                              Personally I like to be exact, so if (I know this is unlikely) someone has 2 variables called the same thing, one in a COOKIE and then POSTs one, there could be issues. After this post I have been looking into it more and have realised that I was wrong to change that. You are right it is irrelavent and does not need to be changed.

                              Comment

                              Working...