Lab Sheet 3
Lab Sheet 3
Write a PHP MYSQL program to collect the student data and store in Server database.
a. Student Name, Roll_no, mail_id, mobile_no, gender, city, state and
department - Minimum 4 students records to insert.
b. Display the student’s details
b. Update the student’s details
c. Delete the student Record from database.
Registaration.html
<!DOCTYPE html>
<html lang="en-us">
<head> <title>Responsive Registaration Form</title></head>
<body>
<h1>Student Registaration Form</h1>
<form class="srf" action="http://localhost/insertdb.php" method="post">
<br><br>Roll No:<input type="text" id="rollno" name="rollno" >
<br><br>Student Name:<input type="text" id="name" name="name" >
<br><br>Email:<input type="email" id="email" name="email" >
<br><br>Mobile:<input type="tel" id="mobile" name="mobile" >
<br><br>Gender:<input type="radio" id="male" name="gender" value="male"/>Male
<input type="radio" id="female" name="gender" value="female"/>Female
<br><br>City:<input type="text" id="city" name="city" maxlength="10">
<br><br>State:<input type="text" id="state" name="state">
<br><br>Specialization:<br><br>
<input type="checkbox" name="specialization" value="Computer Science">Computer
Science<br/>
<input type="checkbox" name="specialization" value="Information
Technology">Information Technology<br/>
<input type="checkbox" name="specialization" value="Computer
Architecture">Computer Architecture<br/>
<input type="checkbox" name="specialization" value="Tele Communication">Tele
Communication<br/>
<br><br><input type="submit" value="Register" onclick="SaveStudentDetails()">
</form>
</body>
</html>
</body>
</html>
insertdb.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ls9_srf"; // DB Name
updatedb.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
// Check connection
if (!$conn) {
if (mysqli_query($conn, $sql)) {
} else {
mysqli_close($conn);
?>
Deletedb.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
// Check connection
if (!$conn) {
}
$sql = "DELETE FROM srf WHERE Roll_No='20201CSE0004'";
$conn->close();
?>
OUTPUT
Registration from