Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    $_Post "Empty" on form Submit

    Alright, this was working last week, and I come into the office yesterday and all of my forms no longer work.

    Checking print_r($_POST) , var_dump($_POST), etc. they all return blank.

    Firebug shows the posted values.

    Yesterday I get it to work once after clearing all Temporary Internet Files from IE, but even continuing to do that each time, it no longer works.

    Does anyone have any idea why this would suddenly stop working, and what I could do to fix it?

    (Using $_GET instead is not really an option here, but in testing $_GET does work just fine.)
    Last edited by lizsatoshi; 11-16-2011 at 07:24 PM.

  • #2
    New Coder
    Join Date
    Feb 2011
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    can you post your code and markup?

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is an extremely scaled down version of my code, but it is still not working.
    PHP Code:
    <HTML>
    <body>
    <?php 
    print_r
    ($_POST);

    var_dump($_POST);

    if(isset(
    $_POST['Submit'])) { 
        echo 
    "yes";


    ?>
    <form name="form1" method="post" action="<? echo$_SERVER['PHP_SELF'?>">
    Location Name:<input name="locationname" type="text" id="locationname"size="25">
    <input type="submit" name="Submit" value="Submit"> 
    <input type="reset" name="Submit2" value="Reset">
    </form>

    </body>
    </HTML>

  • #4
    New Coder
    Join Date
    Feb 2011
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I think your problem lies with your form action.
    Try to get into the habit of declaring your php tags with <?php

    Try this:

    PHP Code:
    <HTML>
    <body>
    <?php 
    print_r
    ($_POST);

    var_dump($_POST);

    if(isset(
    $_POST['Submit'])) { 
        echo 
    "yes";

    ?>

    <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'?>">
    Location Name:<input name="locationname" type="text" id="locationname"size="25">
    <input type="submit" name="Submit" value="Submit"> 
    <input type="reset" name="Submit2" value="Reset">
    </form>

    </body>
    </HTML>

  • #5
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I appreciate the thought, but as i said, this code was working as before. I did add the <?php but no change.

  • #6
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do not believe it to be a problem with my code. Espicially since Firebug catches the $_POST. Maybe a server issue? I haven't touched the conf file since I installed the thing weeks ago. The only thing that has changed on the system would be Windows Updates. Could that cause a problem like this?

  • #7
    New Coder
    Join Date
    Sep 2010
    Location
    The Twilight Zone
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    You're missing a semicolon after echo in your action attribute.

  • #8
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. Doesn't make a difference. As I said, not a problem with the code. Guess I will try a different forum.

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Open the output source code in your browser.
    Does the PHP code show in there?

    Edit:
    BTW, in PHP $_POST is NEVER empty. Its a superglobal thats defined by default, so even when using a program directly on the cli you will end up with the results of Array(). This is why my assumption is you can view the PHP code within your HTML source.

  • #10
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Open the output source code in your browser.
    Does the PHP code show in there?

    BTW, in PHP $_POST is NEVER empty. Its a superglobal thats defined by default, so even when using a program directly on the cli you will end up with the results of Array(). This is why my assumption is you can view the PHP code within your HTML source.
    No it does not show. The ARRAY is empty is what I should have said.

    On the bright side, I figured it out.

    I was navigating from a page that used NTLM Authentication so because of blahblahblahsecurity reason i dont understandblahblahblah the $_POST was empty. This was my fault, I just had not added the same function to all my pages yet.

    The reason it would work sometimes in other browsers was because I would go to the form's page directly from the address bar, instead of going through the homepage(the page with the NTLM).

    Hope this helps anyone else having a similar problem. (Though it probably won't as I don't really know WHY NTLM hates me so much. )


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •