I am using this code. To insert name and rollno in table named 'tablename' in database 'dbname'.
db.php
<html>
<body>
<form name="db" action="db.php" method=post>
Enter name <input type=text name="nam"/><br><br>
Enter RollNo. <input type=text name="rno"/><br><br>
<input type=submit value="Click me"/>
</form>
<?php
$nam = $_POST['nam'];
$rno = $_POST['rno'];
mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('dbname') or die(mysql_error());
$sql="insert into tablename values('$nam','$rno')";
mysql_query($sql);
?>
</body>
</html>
It show the error, that
Notice: Undefined index: nam in C:\wamp\www\DB Connectivity\db.php on line 10
Notice: Undefined index: rno in C:\wamp\www\DB Connectivity\db.php on line 11
Plz give solution, how to use html and php in the same page without this error.