Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/252041-server-request-method-defaults-to-get/
Share on other sites

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.