HTML_PHP_Student_Assignment
HTML_PHP_Student_Assignment
html
<!DOCTYPE html>
<html>
<head>
<title>Student Record</title>
</head>
<body>
<h2>Student Record</h2>
<form action="student_insert.php" method="post">
Student ID: <input type="text" name="std_id"><br><br>
Student Name: <input type="text" name="std_name"><br><br>
Student Class: <input type="text" name="std_class"><br><br>
Student Age: <input type="text" name="std_age"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
student_insert.php
<?php
$conn = mysqli_connect("localhost", "root", "", "db_college");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$std_id = $_POST['std_id'];
$std_name = $_POST['std_name'];
$std_class = $_POST['std_class'];
$std_age = $_POST['std_age'];
student_display.php
<?php
$conn = mysqli_connect("localhost", "root", "", "db_college");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM tb_student";
$result = mysqli_query($conn, $sql);
database_setup.sql
CREATE DATABASE IF NOT EXISTS db_college;
USE db_college;