Teacher.php
<HTML>
<BODY>
<FORM method=POST
action="<?php echo $_SERVER['PHP_SELF'] ?>">
<b><h3>Perform
operations on the TEACHER Table</b><BR>
<INPUT type=radio
name="choice" value="1">Create<BR>
<INPUT type=radio
name="choice" value="2">Insert<BR>
<INPUT type=radio
name="choice" value="3">Update<BR>
<INPUT type=radio
name="choice" value="4">Delete<BR>
<INPUT type=submit name=submit
value="Operation Perform"><BR>
</FORM>
<?php
$hn="localhost";
$db="Teach";
$un="root";
$psw="";
$link=mysqli_connect($hn,$un,$psw,$db);
if(isset($_POST['submit']))
{
$ch=$_POST['choice'];
if($ch=='1')
{
if(!$link)
{
die('connection
faild:'.mysql_error());
}
$sql="create
table teacher(tid int,tname varchar(10),addr varchar(20),sub
varchar(10))";
if(mysqli_query($link,$sql))
{
echo"Table
created Successfully";
}
else
{
echo"Unable
to perform";
}
}
if($ch=='2')
{
if(!$link)
{
die('connection
faild:'.mysql_error());
}
$sql="insert
into teacher values('102','Prof.Bhilare','Malegaon','PHP')";
if(mysqli_query($link,$sql))
{
echo"Row
inserted Successfully";
}
else
{
echo"Unable
to perform";
}
}
if($ch=='3')
{
if(!$link)
{
die('connection
faild:'.mysql_error());
}
$sql="update
teacher SET addr='Baramati' where tid='101'";
if(mysqli_query($link,$sql))
{
echo"Record
Updated Successfully";
}
else
{
echo"Unable
to perform";
}
}
if($ch=='4')
{
if(!$link)
{
die('connection
faild:'.mysql_error());
}
$sql="delete
from teacher where tid='101'";
if(mysqli_query($link,$sql))
{
echo"Record
Deleted Successfully";
}
else
{
echo"Unable
to perform";
}
}
}
mysqli_close($link);
?>
</BODY>
</HTML>