1. Create a php program to insert student data to database.
SOURCE CODE:
W1.html
<html>
<head>
</head>
<body>
<h1 align="center"> STUDENT REGISTRATION</h1>
<form name="frmstudent" method="post" action="student.php">
Roll no: <input type="text" name="t1"><br><br>
First name: <input type="text" name="t2"><br><br>
Last Name :<input type="text" name="t3"><br><br>
<input type="submit" value="submit">
</form>
</body>
</html>
student.php
<?php
ini_set('display_errors', 1);
error_reporting(-1);
$con = mysqli_connect("localhost","kashi","dbpassword","studentphp");
$rno = $_POST['t1'];
$fname=$_POST['t2'];
$lname=$_POST['t3'];
$sql = "insert into students values ('$rno','$fname','$lname')";
$rs=mysqli_query($con,$sql);
if($rs)
{
echo " Records Inserted";
}
else
{
echo "Porblem";
}
?>
OUTPUT:
DATABASE: