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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts

    POST not working on single page

    So I've been working on a site recently, and I've run into a serious problem.

    I have a login page for the admin section, and a separate login page for the regular users. The admin login works just fine, as well as all the content within the admin section, but when I try to submit the regular login with POST, the $_POST comes up blank. When I change the form to GET, the page passes variables through the URL as expected. For the life of me, I can't figure out whats goin on... the two admin pages are almost identical, yet the form works with GET and not POST.

    Does anyone have any idea why this may be? I'd be more then glad to link pages, but the site runs off a dispatcher, so I'd actually have to send you a few pages if you wanted to look at the code.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Keleth View Post
    So I've been working on a site recently, and I've run into a serious problem.

    I have a login page for the admin section, and a separate login page for the regular users. The admin login works just fine, as well as all the content within the admin section, but when I try to submit the regular login with POST, the $_POST comes up blank. When I change the form to GET, the page passes variables through the URL as expected. For the life of me, I can't figure out whats goin on... the two admin pages are almost identical, yet the form works with GET and not POST.

    Does anyone have any idea why this may be? I'd be more then glad to link pages, but the site runs off a dispatcher, so I'd actually have to send you a few pages if you wanted to look at the code.
    post the relevant part of your code, please.

    best regards

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please post the html as well as php code.

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Ok, don't say I didn't warn ya

    The form:
    Code:
    <form method="post" action="<?php echo SITEROOT; ?>/process/login">
    	<input type="hidden" name="clientID" value="<?php echo $pathOptions[0]; ?>">
    	<div class="tr">
    		<label class="floatLeft">User:</label>
    		<div class="textBox"><input type="text" name="username"></div>
    	</div>
    	<div class="tr">
    		<label class="floatLeft">Password:</label>
    		<div class="textBox"><input type="password" name="password"></div>
    	</div>
    	<div id="buttonDiv">
    		<span class="button"><span><input type="submit" name="submit" value="Submit"></span></span>
    		<span style="width: 20px;">&nbsp;</span>
    		<span class="button"><span><input type="reset" name="clear" value="Clear"></span></span>
    	</div>
    </form>
    The processing page:
    Code:
    <?php
    	print_r($_POST);
    ?>

    If I change method="post" to method="get", and print_r($_GET), the stuff that passes shows up fine.

    If I were to post everything relating to the two pages (the dispatcher, the verification code, etc), It'd be closer to 200 lines of code
    Last edited by Keleth; 03-09-2009 at 04:26 PM.

  • #5
    New Coder
    Join Date
    Jul 2007
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Are you getting anything if you do this?

    PHP Code:
    print_r($_REQUEST); 
    -

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    print_r($_REQUEST) when I have method="post" gives me a black array.

  • #7
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Keleth View Post
    Ok, don't say I didn't warn ya

    The form:
    Code:
    <form method="post" action="<?php echo SITEROOT; ?>/process/login">
    	<input type="hidden" name="clientID" value="<?php echo $pathOptions[0]; ?>">
    	<div class="tr">
    		<label class="floatLeft">User:</label>
    		<div class="textBox"><input type="text" name="username"></div>
    	</div>
    	<div class="tr">
    		<label class="floatLeft">Password:</label>
    		<div class="textBox"><input type="password" name="password"></div>
    	</div>
    	<div id="buttonDiv">
    		<span class="button"><span><input type="submit" name="submit" value="Submit"></span></span>
    		<span style="width: 20px;">&nbsp;</span>
    		<span class="button"><span><input type="reset" name="clear" value="Clear"></span></span>
    	</div>
    </form>
    The processing page:
    Code:
    <?php
    	print_r($_POST);
    ?>

    If I change method="post" to method="get", and print_r($_GET), the stuff that passes shows up fine.

    If I were to post everything relating to the two pages (the dispatcher, the verification code, etc), It'd be closer to 200 lines of code
    this is a custom cms?
    it's a guess but I think the problem is in dispatcher. Check to see if you do some specific processing based on the method of the request.

    best regards

  • #8
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Yah, its a custom CMS. The problem is, I don't know what kind of processing could interfere... the only function that's different between the two login pages is one I disabled and it still isn't working.

    I didn't come here expecting magical answers, so I apologize if it came across as that... I just wondered if someone ever had a common error that sounds familiar to this. I've been trying to figure out what's killing the post for 3 hours and im pullin my hair out

  • #9
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Change the name of your submit button to "submitbtn". As weird as it sounds, I've seen submit buttons named "submit" interfere before.

  • #10
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Quote Originally Posted by Fumigator View Post
    Change the name of your submit button to "submitbtn". As weird as it sounds, I've seen submit buttons named "submit" interfere before.
    Sensible, tried it, no luck. Thanks though!

  • #11
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Did you try other browsers? Opera? Safari? IE? FF? Same results with all?

    Try hard-coding the "action" property. Does your script really not have an extension; it's just named "login"?

    Validate the HTML.

    That's the stuff I'd try if I were desperately trying to figure out what's up.

  • #12
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Keleth View Post
    Yah, its a custom CMS. The problem is, I don't know what kind of processing could interfere... the only function that's different between the two login pages is one I disabled and it still isn't working.

    I didn't come here expecting magical answers, so I apologize if it came across as that... I just wondered if someone ever had a common error that sounds familiar to this. I've been trying to figure out what's killing the post for 3 hours and im pullin my hair out
    first try Fumigator suggestion, then if don't give expected results and if you can post some code from dispatcher that you think that are relevant.
    Another place to look is how you rewrite the url, if you use this( in htaccess probably).

    best regards

  • #13
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Quote Originally Posted by Fumigator View Post
    Change the name of your submit button to "submitbtn". As weird as it sounds, I've seen submit buttons named "submit" interfere before.
    I believe, it makes trouble, only when we use obj.submit(). function to submit our page by javascript. But then the form won't get submitted actaully.

    I had some issues with my htaccess rewrite rule, which ruined my GET variables
    Code:
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?page=$1 [L]
    (..a custom framework, where i used the $_SERVER['REQUEST_URI'] to serve the right pages to the user.)

    I can't guess something similar with POST though.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #14
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Ok, so I went through some of the stuff people suggested here and it gets interesting...

    So I went back and compared the admin login to the regular login, and there are no processing differences. However, when I remove the action (the form points back to the current page), the post passes. Its when I add the action that the post fails. This seems to indicate that its not the dispatcher... but then I can't think of what else could be the issue...

    EDIT: Some more testing and I'm still stumped.

    Basically what I did was a few test to see why the admin section worked but the regular section didn't. I setup a page that just sent one variable from the regular section to the admin login processor, and it passed. Then I sent a variable from that same page to the regular login processor, and it failed, even prior to any processing from the dispatch (but after the htaccess obviously). This is, quite literally, driving me nuts.
    Last edited by Keleth; 03-09-2009 at 11:06 PM.

  • #15
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Never mind, thought I solved the problem, I didn't.

    EDIT:

    And I've figured out the problem... and its more confusing then what it was before.

    In the method, I had "/BitBallot/process/login". When I changed it to "/BitBallot/process/login/" (added the last /) it works...
    My dispatcher drops that last "/", so to the dispatcher... its the same url...
    Last edited by Keleth; 03-09-2009 at 11:34 PM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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