Nothing happens when the User clicks the submit button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kasl
    New Member
    • Jun 2007
    • 14

    Nothing happens when the User clicks the submit button

    I updated my website with a new contact form and for some reason when I click on the SUBMIT button, it doesn't work. I have had several people try with no luck with the exception of the creator of the contact page who is stumped as well. If anyone has any suggestions, I would greatly appreciate it. I am VERY new to coding so please keep that in mind when reading this and if you respond :) Thanks!!

    Here is what I have for my contact.php file....

    [code=php]<?php

    $name = $HTTP_POST_VARS['Name'];
    $email = $HTTP_POST_VARS['Email'];
    $message = $HTTP_POST_VARS['Message'];
    $phone = $HTTP_POST_VARS['Phone'];

    $message = stripslashes($m essage);

    $sendTo = "I inserted my email address here";
    $subject = "Message from Web Site";

    $msg_body = "Name: $name\n";
    $msg_body .= "E-Mail: $email\n";
    $msg_body .= "Comments: $message\n";
    $msg_body .= "Phone: $phone\n";

    $header_info = "From: ".$name." <".$email.">" ;

    mail($sendTo, $subject, $msg_body, $header_info);

    ?>[/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]
    Last edited by pbmods; Jun 9 '07, 03:19 PM. Reason: Added code tags.
  • nomad
    Recognized Expert Contributor
    • Mar 2007
    • 664

    #2
    Originally posted by kasl
    I updated my website with a new contact form and for some reason when I click on the SUBMIT button, it doesn't work. I have had several people try with no luck with the exception of the creator of the contact page who is stumped as well. If anyone has any suggestions, I would greatly appreciate it. I am VERY new to coding so please keep that in mind when reading this and if you respond :) Thanks!!

    Here is what I have for my contact.php file....

    <?php

    $name = $HTTP_POST_VARS['Name'];
    $email = $HTTP_POST_VARS['Email'];
    $message = $HTTP_POST_VARS['Message'];
    $phone = $HTTP_POST_VARS['Phone'];

    $message = stripslashes($m essage);

    $sendTo = "I inserted my email address here";
    $subject = "Message from Web Site";

    $msg_body = "Name: $name\n";
    $msg_body .= "E-Mail: $email\n";
    $msg_body .= "Comments: $message\n";
    $msg_body .= "Phone: $phone\n";

    $header_info = "From: ".$name." <".$email.">" ;

    mail($sendTo, $subject, $msg_body, $header_info);

    ?>
    Question:
    Where are you send your input (data) to ie database e-mail, spread sheet.

    nomad

    Comment

    • kasl
      New Member
      • Jun 2007
      • 14

      #3
      Originally posted by nomad
      Question:
      Where are you send your input (data) to ie database e-mail, spread sheet.

      nomad
      This script was designed by someone else (the person I purchased the web template for my site from) so from what little I know, I believe it goes to email.
      Unfortunately, the creator of the script has no idea why when she tests it it works for her but when I try it it doesn't.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Changed thread title to remove ALL CAPS.

        Originally posted by kasl
        Unfortunately, the creator of the script has no idea why when she tests it it works for her but when I try it it doesn't.
        When she tries it, is she connecting to the same server as you are? In other words, when she tests it, is she using her own personal server, but when you test it, you're using your server instead?

        It sounds like the mail function is having problems. Check out this thread to debug the problem.

        Comment

        • epots9
          Recognized Expert Top Contributor
          • May 2007
          • 1352

          #5
          maybe the smtp server u are trying to use is wrong and/or there is no from.

          if u can access the the php.ini, change:
          on line 689 (php-5.2.3-Win32)
          smtp = your_smtp

          and
          online 693 (php-5.2.3-Win32)
          sendmail_from = me@example.com
          **there might be a semi-colon (;) there, remove it

          if u can't access the php.ini, add this at the top of your code:
          [PHP]
          ini_set("smtp", "your_smtp");
          ini_set("sendma il_from", "me@example.com");
          [/PHP]


          **items in italic must be changed
          hopefully that does the trick, let me know.

          Comment

          • bucabay
            New Member
            • Apr 2007
            • 18

            #6
            Originally posted by kasl
            I updated my website with a new contact form and for some reason when I click on the SUBMIT button, it doesn't work. I have had several people try with no luck with the exception of the creator of the contact page who is stumped as well. If anyone has any suggestions, I would greatly appreciate it. I am VERY new to coding so please keep that in mind when reading this and if you respond :) Thanks!!

            Here is what I have for my contact.php file....

            [code=php]<?php

            $name = $HTTP_POST_VARS['Name'];
            $email = $HTTP_POST_VARS['Email'];
            $message = $HTTP_POST_VARS['Message'];
            $phone = $HTTP_POST_VARS['Phone'];

            $message = stripslashes($m essage);

            $sendTo = "I inserted my email address here";
            $subject = "Message from Web Site";

            $msg_body = "Name: $name\n";
            $msg_body .= "E-Mail: $email\n";
            $msg_body .= "Comments: $message\n";
            $msg_body .= "Phone: $phone\n";

            $header_info = "From: ".$name." <".$email.">" ;

            mail($sendTo, $subject, $msg_body, $header_info);

            ?>[/code]

            [Please use CODE tags when posting source code. Thanks! --pbmods]

            What do you mean by "when I click on the SUBMIT button, it doesn't work"?

            What actually happens when you click the submit button?
            Does it not do anything at all?
            Do you got to the next page, but the it is blank?
            Does it go to the next page, but you don't get an email with results?
            Do you get an error?

            Also, the use of "$HTTP_POST_VAR S" is deprecated since PHP4.1+. Use $_POST instead.

            Comment

            • kasl
              New Member
              • Jun 2007
              • 14

              #7
              Originally posted by epots9
              maybe the smtp server u are trying to use is wrong and/or there is no from.

              if u can access the the php.ini, change:
              on line 689 (php-5.2.3-Win32)
              smtp = your_smtp

              and
              online 693 (php-5.2.3-Win32)
              sendmail_from = me@example.com
              **there might be a semi-colon (;) there, remove it

              if u can't access the php.ini, add this at the top of your code:
              [PHP]
              ini_set("smtp", "your_smtp");
              ini_set("sendma il_from", "me@example.com");
              [/PHP]


              **items in italic must be changed
              hopefully that does the trick, let me know.
              Thanks for the help. I can't access the php.ini so I added to the code in the contact.php Either it didn't work or I did't input it correctly. Here is what I did...
              [code=php]
              <?php

              ini_set("smtp", "your_smtp" );
              ini_set("sendma il_from", "my email");
              $name = $HTTP_POST_VARS['Name'];
              $email = $HTTP_POST_VARS['Email'];
              $message = $HTTP_POST_VARS['Message'];
              $phone = $HTTP_POST_VARS['Phone'];

              $message = stripslashes($m essage);

              $sendTo = "my email";
              $subject = "Message from Web Site";

              $msg_body = "Name: $name\n";
              $msg_body .= "E-Mail: $email\n";
              $msg_body .= "Comments: $message\n";
              $msg_body .= "Phone: $phone\n";

              $header_info = "From: ".$name." <".$email.">" ;

              mail($sendTo, $subject, $msg_body, $header_info);

              ?>[/code]

              Comment

              • kasl
                New Member
                • Jun 2007
                • 14

                #8
                Originally posted by pbmods
                Changed thread title to remove ALL CAPS.



                When she tries it, is she connecting to the same server as you are? In other words, when she tests it, is she using her own personal server, but when you test it, you're using your server instead?

                It sounds like the mail function is having problems. Check out this thread to debug the problem.
                \
                I am not sure if she uses th same server..doubt it. I will look into this though. Thanks.

                Comment

                • kasl
                  New Member
                  • Jun 2007
                  • 14

                  #9
                  Originally posted by bucabay
                  What do you mean by "when I click on the SUBMIT button, it doesn't work"?

                  What actually happens when you click the submit button?
                  Does it not do anything at all?
                  Do you got to the next page, but the it is blank?
                  Does it go to the next page, but you don't get an email with results?
                  Do you get an error?

                  Also, the use of "$HTTP_POST_VAR S" is deprecated since PHP4.1+. Use $_POST instead.
                  When I click the submit button, the button "blinks" but there is no cosequence..the page stays the same..nothing changes..the information is still on the form...no errors. And the reset button works to clear the form.

                  I tried$_POST and no luck,

                  Thanks though.

                  Comment

                  • kasl
                    New Member
                    • Jun 2007
                    • 14

                    #10
                    Originally posted by kasl
                    \
                    I am not sure if she uses th same server..doubt it. I will look into this though. Thanks.
                    I tried the debugging suggestions and no luck either. thanks though.

                    Comment

                    • ak1dnar
                      Recognized Expert Top Contributor
                      • Jan 2007
                      • 1584

                      #11
                      info.php
                      [PHP]<?php
                      phpinfo();
                      ?>
                      [/PHP]

                      create this file and put it to your web server root and execute.
                      http://www.yourdomain. com/info.php

                      and please submit the configuration settings here for smtp settings from the page you getting.

                      Comment

                      • kasl
                        New Member
                        • Jun 2007
                        • 14

                        #12
                        Originally posted by ajaxrand
                        info.php
                        [PHP]<?php
                        phpinfo();
                        ?>
                        [/PHP]

                        create this file and put it to your web server root and execute.
                        http://www.yourdomain. com/info.php

                        and please submit the configuration settings here for smtp settings from the page you getting.
                        I hope I am giving you the right info...let me know otherwise. Thanks!

                        SMTP localhost localhost
                        smtp_port 25 25

                        Comment

                        • ak1dnar
                          Recognized Expert Top Contributor
                          • Jan 2007
                          • 1584

                          #13
                          Originally posted by kasl
                          I hope I am giving you the right info...let me know otherwise. Thanks!

                          SMTP localhost localhost
                          smtp_port 25 25
                          • If you are using a purchased web hosting package from a vendor and if you execute this info.php file under that location your SMTP setting might be correct.
                          • but if you used your local machine web server to execute this info.php file, this SMTP configuration is not valid.you have to use a SMTP server under your local host.

                          let me know which one was yours from those two.

                          Comment

                          • kasl
                            New Member
                            • Jun 2007
                            • 14

                            #14
                            Originally posted by ajaxrand
                            • If you are using a purchased web hosting package from a vendor and if you execute this info.php file under that location your SMTP setting might be correct.
                            • but if you used your local machine web server to execute this info.php file, this SMTP configuration is not valid.you have to use a SMTP server under your local host.

                            let me know which one was yours from those two.
                            I believe (from the best of my limited konwledge) that I used my local machine web server. I did purchase this package from a vendor but I use my server to access the info.

                            Comment

                            • ak1dnar
                              Recognized Expert Top Contributor
                              • Jan 2007
                              • 1584

                              #15
                              Originally posted by kasl
                              I believe (from the best of my limited konwledge) that I used my local machine web server. I did purchase this package from a vendor but I use my server to access the info.
                              Normally if you purchased a web hosting package with php support by default php mail facility is available. but sometimes they might disable it. you have to verify it with your service provider.

                              Since you are trying this local machine web server (no doubts php is working,since it has executed this info.php file) you have to configure your php.ini file to work with php mail.

                              Find the php.ini file from your php root dir.

                              if you are on a windows box you can locate it under C:\WINDOWS or under your php installation dir.
                              Hint: use the system search tool to locate it.
                              then open it using a text editor, find this line.and enter your smtp host name
                              Code:
                              SMTP = mail.somehost.com
                              smtp_port = 25
                              You have to use a smtp server address and port here.if you are using a outlook or some kind of mail client in your box. use the smtp of that.

                              Comment

                              Working...