when i enter the url(//login.php) after login it gives undefined index on t1 and t2. how can i use session on this page
index.php
<head> <link rel="stylesheet" type="text/css" href="css/style.css"></head> <h1>Login Here</h1> <form name="f1" action="login.php" method="post"> <table border="1"> <tr><td>username</td><td><input type="text" name="t1"></td> </tr> <tr><td>password</td><td><input type="password" name="t2"></td></tr> <tr><td><input type="submit" value="login"></td> <td class="error"><?php if(isset($_GET['wrong_detial'])){ echo "RE-ENTER username and password !! "; }?> </td> </tr> </table> </form>
this is login.php
<?php include "db/db.php"; $user=$_POST['t1']; $pass=$_POST['t2']; $result=mysql_query("select * from registor where username='$user' and password='$pass' ")or die(mysql_error()); $row=mysql_fetch_row($result); ?> <h1>Welcome Mr. <?php echo $user;?></h1> <?php if(!$user == $row[1] || !$pass ==$row[2]){ //if username or password not matched with database header("location:account.php?wrong_detial"); } else{ if($user == 'admin'){ //if admin login ?> <table border="1"> <tr><td>User ID</td><td>Username</td><td>Password</td><td>Email-ID</td><td>delete</td></tr> <?php $admin_result=mysql_query("select * from registor"); while($admin_db=mysql_fetch_row($admin_result)){ ?> <tr> <td><?php echo $admin_db[0];?></td> <td><?php echo $admin_db[1];?></td> <td><?php echo $admin_db[2];?></td> <td><?php echo $admin_db[3];?></td> <td id="div1"> <a href="delete.php?delete=<?php echo $admin_db[1];?>" id="<?php echo $admin_db[1];?>">Delete</a> <!-- Deleting single record--> <?php if(isset($_GET['user_del'])){ echo "record deleted"; } ?> </td> </tr> <?php } ?> </table> <?php }
this is error Notice: Undefined index: t1 in C:\wamp\www\12dec\core\login.php on line 8 Notice: Undefined index: t2 in C:\wamp\www\12dec\core\login.php on line 9
all is working fine .but when i re-enter the url it gives this error. and how to fix this