0% found this document useful (0 votes)
33 views2 pages

Student Record Management System

The document consists of a web application for managing student records, including an HTML form for data entry, a PHP script to insert records into a MySQL database, and another PHP script to display the records. It also includes a SQL script for setting up the database and the student table. The application allows users to input student information such as ID, name, class, and age, and view all stored records.

Uploaded by

zaynabzaffar03
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

Student Record Management System

The document consists of a web application for managing student records, including an HTML form for data entry, a PHP script to insert records into a MySQL database, and another PHP script to display the records. It also includes a SQL script for setting up the database and the student table. The application allows users to input student information such as ID, name, class, and age, and view all stored records.

Uploaded by

zaynabzaffar03
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

student_form.

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'];

$sql = "INSERT INTO tb_student (std_id, std_name, std_class, std_age)


VALUES ('$std_id', '$std_name', '$std_class', '$std_age')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>

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);

echo "<h2>Student Records</h2>";


if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "ID: " . $row["std_id"]. " - Name: " . $row["std_name"].
" - Class: " . $row["std_class"]. " - Age: " . $row["std_age"]. "<br>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>

database_setup.sql
CREATE DATABASE IF NOT EXISTS db_college;
USE db_college;

CREATE TABLE IF NOT EXISTS tb_student (


std_id INT PRIMARY KEY,
std_name VARCHAR(100),
std_class VARCHAR(50),
std_age INT
);

Common questions

Powered by AI

The 'PRIMARY KEY' constraint, applied to the 'std_id' column in the tb_student table, ensures that each student record has a unique identifier, preventing duplicate entries and maintaining data integrity. It allows efficient indexing and lookup, serving as a definitive reference for student records in SQL operations .

The 'mysqli_connect()' function is used to establish a connection to the MySQL database server. It requires parameters such as the server name, username, password, and database name. If the connection fails, the script terminates with an error message, ensuring that operations are not attempted on a non-existent connection .

When a user submits the form in student_record.html, the data entered in fields like Student ID, Name, Class, and Age is sent to student_insert.php via a POST request. This PHP script then captures these values using the $_POST superglobal array and inserts them into the 'tb_student' database table using an SQL INSERT query. If the insertion is successful, a confirmation message is displayed; if not, an error message is shown .

The PHP scripts could be improved by separating concerns, such as abstracting database connection logic into a separate function or class, using prepared statements for SQL operations to enhance security, organizing HTML and PHP code separately to adhere to MVC architecture, and adding comments and error handling mechanisms for better maintainability and debugging .

Storing student records raises ethical concerns regarding data privacy and security. The database setup should ensure compliance with data protection regulations like GDPR or FERPA, limiting access to authorized personnel only. Storing data without encryption and proper access controls could lead to data breaches, impacting students' privacy and institutional credibility .

To handle an empty result set more user-friendly, the script could display a message like 'No student records found' or provide options for entering new data directly from the display page. Additionally, adding graphical elements or hyperlinks to guide users to the data entry form would enhance the user experience .

Storing student age as an integer assumes it represents a static value, which could lead to incorrect information over time as students age. A more dynamic approach might involve storing a birthdate and calculating age as needed, ensuring the data remains accurate and relevant across different requirements and use cases .

The 'tb_student' table adheres to basic normalization by storing atomic and un-redundant information; each column holds a single piece of data about the student. However, without further context or additional tables, it is difficult to assess compliance beyond First Normal Form (1NF). Further normalization might involve factorizing repetitive or composite relationships into separate tables, which is not elaborated in this setup .

Enhancing user experience could involve adding HTML5 input validation attributes (e.g., 'required', 'pattern') to prevent incorrect data entry, implementing client-side validation scripts for real-time feedback, and providing descriptive place-holders or tooltips to guide users. Furthermore, using dropdowns for class selections and date pickers for birthdates could improve data accuracy and user interaction .

Directly using user inputs in SQL queries poses a significant security risk known as SQL injection, which allows attackers to manipulate the queries and potentially access unauthorized data or execute destructive actions. The student_insert.php script lacks input sanitization and prepared statements, making it vulnerable to such attacks .

You might also like