my code gives undefine index error .. and i don't know how to solve it...
i m making online testing program but every eror in every step is undefine index error...
ok my html file is
<html>
<form action = "http://localhost/onlineexam/home.php" method = 'get'>
<center><h1>WELCOME TO ONLINE EXAMINATION</h1>
<br>
<br> User Name <input type = 'text' name='username'>
<br> Enrolled no <input type = 'text'
name='enrollno'>
<br> <input type ='submit' value='Login' >
</form></center>
</body>
</html>
and my php code is
<?php
$u1=$_GET['username'];
$e1=$_GET['enrollno'];
$ip='localhost';
$user='root';
$pass='';
$con = mysql_connect($ip,$user,$pass);
if(!($con))
die("connection fail");
$db=mysql_select_db('onlinetesting');
if(!($db))
die("<br>database not found");
$querry="select *from login where u_name='$u1',enrolled_no='e1'";
$result= mysql_query($querry);
if($result)
echo("<html>
<center>
<h1> WELCOME $u1</h1>
<h2> CLICK FOR THE TEST START</h2>
<form action='http://localhost/onlineexam/test.php' method='get'>
<input type='hidden' name='id' value='1'>
<input type='submit' value='Start'>
</form>
</center>
</html>
");
else
echo("SORRY $u1 REGISTERED FIRST<br><a href='registration.html'>CLICK HERE</a>");
?>
but it gives the error
Notice: Undefined index: username in M:xampphtdocsonlineexamhome.php on line 3
[this line was $u1=$_GET['username']
Notice: Undefined index: enrollno in M:xampphtdocsonlineexamhome.php on line 4
[this line was $e1=$_GET['enrollno'];
SORRY REGISTERED FIRST
CLICK HERE