How to reset password throgh email in PHP

Im working on password reset method
First it will validate email whether it exists in DB And it will mail with random numbers in url And also when i click on the url in mail it will show the new password form.
But when i submit that form url(random numbers, emailid) will dissapper in url(url?$rand&email=$email)
and it will show error as undefined variables($random,$email).
Whats wrong with below code & how can i correct it.


$email = $_POST["email"];
$rand = $_POST["rand"];


<form action="resetpassword.php" method="POST">
	<input type="hidden" name="email" value="<?php $email; ?>">
	<input type="hidden" name="token" value="<?php $str; ?>">

That’s because POST requests don’t show their values in the URL.

But there is no return value from that
How can i read a var from other file(Except form).

you have no rand/random field in your form.

Isn’t this

<input type="hidden" name="token" value="<?php $str; ?>">
                                           ^ here

the wrong syntax for PHP echo shortcut? If you right-click and ‘view source’ does it have the values correct? If they’re empty the browser won’t submit them even if you get the name correct.

Wrong. The only input elements not submitted are unchecked checkboxes and radio buttons.

all other (named) fields are submitted with their respective–even if empty–value.

Ah, OK, thanks for the clarification.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.