Method POST

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #16
    OK, this seems like a header problem.

    try the following
    - HTML code as is
    - send_simpleform .php:
    Code:
    <?php
    header("Content-Type: text/plain");
    echo "done";
    ?>
    if that behaves the same (quite probable) you need to check the Apache or IIS configuration (whichever server you have). it might be that PHP is not registered as handler.

    and while in Chrome, you can check the file's headers in the developer tools.
    Last edited by Dormilich; Jan 24 '12, 01:25 PM.

    Comment

    • Sheila Jipping
      New Member
      • Jan 2012
      • 18

      #17
      thanks, but still reacting the same.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #18
        what about the file headers in chrome? (Tools > Developer Tools > Network tab)

        Comment

        • Sheila Jipping
          New Member
          • Jan 2012
          • 18

          #19
          it might be that PHP is not registered as handler.

          where would I find that out?

          I did run it in chrome with the devoloper tools on but I'm not sure what I am looking for.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #20
            it might be that PHP is not registered as handler.
            where would I find that out?
            in the server configuration file(s).


            I did run it in chrome with the devoloper tools on but I'm not sure what I am looking for.
            you're looking for the network tab (blue globe with LAN connector). next, click on the file name send_simpleform .php. now the panel changes from a table to some text. the first tab of the text (which should be open now) should read "Headers". look under "Response Headers" for "Content-Type". this should be text/html, were it working. other types may cause the browser to download the file (e.g. application/octet-stream)

            Comment

            • Sheila Jipping
              New Member
              • Jan 2012
              • 18

              #21
              Thanks for all this useful information - pretty slick and, being new to the scene, didn't even realize it existed! But on to the problem at hand.

              when the html code is in the developer mode the method listed is GET even though the code inside says POST.

              The PHP page lists the content type as text-plain.

              The entire process though is no longer opening a separate window at least in the chrome.

              Any other ideas???

              Thanks!

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #22
                You've said other PHP pages have worked fine. Try those pages again and post the PHP for one of those files.

                Comment

                • Sheila Jipping
                  New Member
                  • Jan 2012
                  • 18

                  #23
                  I've never had a POST PHP page work. As you can tell I'm just a beginner.

                  The examples where the PHP code is listed within a Html page work.

                  My setup will preform the statement below properly - just bring that up since it is getting the format to use from another php file.

                  $format = include("local_ format.php")

                  Dormilich walked me thru using chrome to display the html code and I find the GET vs POST command a bit alarming - spoken with very limited knowledge - I would have expected that to be POST.

                  Thanks for your help.

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #24
                    $format = include("local_ format.php")
                    include() is not a function but a language construct. the correct syntax would be include "local_format.p hp";
                    if you want a file’s content in a string use file_get_conten ts().

                    Dormilich walked me thru using chrome to display the html code and I find the GET vs POST command a bit alarming - spoken with very limited knowledge - I would have expected that to be POST.
                    GET/POST command?

                    Comment

                    • Sheila Jipping
                      New Member
                      • Jan 2012
                      • 18

                      #25
                      when the html code is in the developer mode the method listed is GET even though the code inside says POST.

                      this is what I am referring to.

                      Comment

                      • Dormilich
                        Recognized Expert Expert
                        • Aug 2008
                        • 8694

                        #26
                        the HTML page itself must be GET because you call it via URL.

                        Comment

                        • Sheila Jipping
                          New Member
                          • Jan 2012
                          • 18

                          #27
                          well I am still at a stand still - cannot get this basic command to function.

                          any other suggestions???

                          I do notice on the failures that I receive that the secondary PHP page type is coming in as plain/text - if I understand you correctly from prior post that should be html - how would I change that?

                          Thanks for all your help, I do appreciate but it's very hard not to be frustrated.

                          Comment

                          • Dormilich
                            Recognized Expert Expert
                            • Aug 2008
                            • 8694

                            #28
                            I do notice on the failures that I receive that the secondary PHP page type is coming in as plain/text - if I understand you correctly from prior post that should be html - how would I change that?
                            if you used the code from post #16, that's correct. though normally a plain text file should be displayed in the browser (unless you told it to download the file).

                            otherwise could you write down all the headers you get?

                            regarding your server settings, which server do you use? (I only know Apache somewhat)

                            Comment

                            • Sheila Jipping
                              New Member
                              • Jan 2012
                              • 18

                              #29
                              file:///C:/Program%20Files/Apache%20Softwa re%20Foundation/Apache2.2/htdocs/simpleform.html

                              for the php form it is....
                              file:///C:/Program%20Files/Apache%20Softwa re%20Foundation/Apache2.2/htdocs/send_simpleform .php

                              however, shouldn't the second one be localhost/send_simpleform .php?

                              because if I change the address to that then I get a webpage with done on it.

                              Comment

                              • Dormilich
                                Recognized Expert Expert
                                • Aug 2008
                                • 8694

                                #30
                                if you want to use PHP, never use the file: protocol anywhere (not even in the calling HTML page)! if you do, .php is treated as text because the file system recognioses PHP files only as text.

                                Comment

                                Working...