elpedro Posted November 29, 2011 Share Posted November 29, 2011 I have created a login page that links to a username/password reset page upon the user's request. Both pages use: if( $_SERVER[ 'REQUEST_METHOD' ] == "POST" ) The login page works perfectly in every way; however, the reset page does not. The value of the request method echos as GET even before the form is submitted (the value is GET upon loading). The form submission method is POST, but it does not work even after the fields are supplied and the form is submitted. My understanding of the request methods is limited, but I gather the problem relates with the manner that I am linking from the login page to the reset page. Is there a simple explanation for this? Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/252041-server-request-method-defaults-to-get/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 29, 2011 Share Posted November 29, 2011 Your 'reset' form is probably invalid HTML. To get help with any code, you need to post enough of your code that reproduces the symptom. Quote Link to comment https://forums.phpfreaks.com/topic/252041-server-request-method-defaults-to-get/#findComment-1292193 Share on other sites More sharing options...
elpedro Posted November 29, 2011 Author Share Posted November 29, 2011 Thank you for your prompt reply. I was relatively certain that it is not an invalid HTML issue; the HTML in the 'reset' page is a carbon copy of that in the 'login' page, except for a few lines of content. I assume it must be a conceptual issue, and hence the lack of a specific code fragment. The form field looks as follows, and the remainder is identical to the 'login' HTML. <form method = "POST" action = "login.php" autocomplete = "off"/> <div id = "fields"> <p>USERNAME</p> <input type = "text" name = "username" value = ""/> <p>PASSWORD</p> <input type = "password" name = "password" value = ""/> <p>RETYPE PASSWORD</p> <input type = "password" name = "password_retyped" value = ""/> <input type = "submit" name = "Submit" value = "Submit"/> </div> </form> I can not see anything above that would cause such a change. Please let me know if you can. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/252041-server-request-method-defaults-to-get/#findComment-1292221 Share on other sites More sharing options...
PFMaBiSmAd Posted November 29, 2011 Share Posted November 29, 2011 Is that the ONLY form on the page? Also, if the action of that form is login.php, how is that accomplishing a password reset? Quote Link to comment https://forums.phpfreaks.com/topic/252041-server-request-method-defaults-to-get/#findComment-1292225 Share on other sites More sharing options...
elpedro Posted November 29, 2011 Author Share Posted November 29, 2011 Ah - how two pairs of eyes are infinitely better than one! A simple cut-paste error. Thank you very much for that. Incidentally, the server request method defaults to GET, as I discovered by echoing the value in my 'login' form. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/252041-server-request-method-defaults-to-get/#findComment-1292279 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.