$_POST problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joey99881
    New Member
    • Jul 2010
    • 8

    $_POST problems

    Hi all,

    Take one form:

    Code:
    <form method="post" action="process.php" />
      <input type="text" name="foreame" />
      <input type="text" name="surname" />
      <input type="submit" value="Submit" />
    </form>
    Add in a php script:

    Code:
    <?php
      $firstame = $_POST['foreame'];
      $lastname = $_POST['surname'];
    
      echo "Hello ". $firstame . " " . $lastname;
      echo "Thank you for ordering from us";
    
      echo var_dump($_POST);
    
    ?>
    Result:

    Blank screen.

    Any ideals? Ta!
    Last edited by Atli; Aug 13 '10, 08:07 PM. Reason: Please use [code] tags when posting code.
  • joey99881
    New Member
    • Jul 2010
    • 8

    #2
    $firstame = $_POST['foreame'];..........

    I Im of course spelling firstname correctly in the script...

    Comment

    • JKing
      Recognized Expert Top Contributor
      • Jun 2007
      • 1206

      #3
      Total blank screen? Not even "Hello Thank you for ordering from us"?

      Is the file name for your script correct? Any errors? Do you have error reporting on?

      Comment

      • joey99881
        New Member
        • Jul 2010
        • 8

        #4
        No, not even "Hello Thank you for ordering from us"!

        Ive double checked the filenames and they are all correct. May it's a problem with my web server?

        Comment

        • JKing
          Recognized Expert Top Contributor
          • Jun 2007
          • 1206

          #5
          Are you working locally?

          Is error reporting on?

          Comment

          • joey99881
            New Member
            • Jul 2010
            • 8

            #6
            Ive checked php.ini and error_reporting = E_ALL is set.
            Also Im working locally with wamp

            Comment

            • JKing
              Recognized Expert Top Contributor
              • Jun 2007
              • 1206

              #7
              How are you accessing the page?

              Comment

              • joey99881
                New Member
                • Jul 2010
                • 8

                #8
                Er...

                Im getting the submit button in form.html to call process.php

                Sorry Im not that experienced

                Comment

                • Atli
                  Recognized Expert Expert
                  • Nov 2006
                  • 5062

                  #9
                  Does your URL look like "http://localhost/..." or something like "file:///C:/wamp/..."? If it's the second one, change it to the first one.

                  In the page that should show "Thank you for ordering from us", is anything printed to the source? (Right-click->View Page Source)
                  If you see the PHP code itself, and the URL is correct, then your HTTP server is not configured to use PHP.

                  Comment

                  • joey99881
                    New Member
                    • Jul 2010
                    • 8

                    #10
                    By Jove! I changed it to http://localhost/... and it works. Obviouis really. I was editing the site in dreamweaver and just pressing F12 to preview the page in firefox. Never realised that this would bypass wamp!

                    Thanks for your help and sorry for being a muppit!

                    Comment

                    Working...