les a user come on index.php page. he sees login form. but he forgot his password. so he click forgot password.
on forgotpassword.php page he fills a form.
<form action = 'forgotpassword.php' method = 'post'>
Username: <input type='username' name='username'><br/>
E-Mail: <input type='email' name = 'email'><br/>
<input type='submit' value='get password'>
<a href="index.php">[BACK]</a>
</form>
when he is done, he hits submit button. keep in mind he is not login at this movment.
so php code runs. and i want to check that if user name he enter in form is in database.
to get the form user name i did
$username = $_POST['username'];
now to check if $username is in database. code below works fine if user in logedin.
but problem is user is NOT loged in at this point. so $user = $_SESSION['username']; wont work
//usernamedb = get from table
$user = $_SESSION['username'];
$queryget = mysql_query("SELECT username FROM user WHERE username = '$user'") or die("query didnt work");
$row = mysql_fetch_assoc($queryget);
$username_db = $row['username'];