Sure, I can help you create a web application for students using XAMPP as a local server.
Below are the steps and code snippets to get you started:
Step 1: Set Up XAMPP
1. Download and Install XAMPP: You can download XAMPP from the official website and follow
the installation instructions1.
2. Start Apache and MySQL: Open the XAMPP Control Panel and start the Apache and MySQL
services.
Step 2: Create the Database
1. Open phpMyAdmin: Go to http://localhost/phpmyadmin/.
2. Create a Database: Create a new database named student_portal.
3. Create Tables: Use the following SQL queries to create the necessary tables:
CREATE TABLE student_details (
student_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(100)
);
CREATE TABLE speciality (
program_name VARCHAR(100),
student_id INT,
FOREIGN KEY (student_id) REFERENCES student_details(student_id)
);
CREATE TABLE classes (
class_id INT AUTO_INCREMENT PRIMARY KEY,
room VARCHAR(50)
);
CREATE TABLE modules (
module_name VARCHAR(100),
class_id INT,
semester INT,
FOREIGN KEY (class_id) REFERENCES classes(class_id)
);
CREATE TABLE timetable (
module VARCHAR(100),
day VARCHAR(50),
time TIME,
room VARCHAR(50)
);
Step 3: Create the Web Application
1. Project Structure: Create a new folder in the htdocs directory of XAMPP (e.g., C:\
xampp\htdocs\student_portal).
2. Create index.php for Login:
<!DOCTYPE html>
<html>
<head>
<title>Student Login</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h2>Student Login</h2>
<form action="dashboard.php" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br>
<input type="submit" value="Login">
</form>
</body>
</html>
3. Create dashboard.php to Display Student Details:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "student_portal";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$email = $_POST['email'];
$sql = "SELECT sd.first_name, sd.last_name, s.program_name, m.module_name,
m.semester, t.day, t.time, t.room
FROM student_details sd
JOIN speciality s ON sd.student_id = s.student_id
JOIN modules m ON s.program_name = m.module_name
JOIN timetable t ON m.module_name = t.module
WHERE sd.email = '$email'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "Name: " . $row["first_name"]. " " . $row["last_name"]. "<br>";
echo "Program: " . $row["program_name"]. "<br>";
echo "Semester: " . $row["semester"]. "<br>";
echo "Timetable: " . $row["module_name"]. " - " . $row["day"]. " - " .
$row["time"]. " - " . $row["room"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
4. Create style.css for Styling:
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
}
h2 {
text-align: center;
margin-top: 50px;
}
form {
width: 300px;
margin: 0 auto;
padding: 30px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="email"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
border: none;
border-radius: 5px;
color: #fff;
font-size: 16px;
}
Step 4: Test the Application
1. Access the Application: Open your web browser and go to
http://localhost/student_portal/.
2. Login: Enter a name and email to log in and view the student’s details and timetable.
Feel free to customize the code and database structure as needed for your specific requirements.
If you have any questions or need further assistance, let me know!
Sure, I can help you create a web application for students to access their academic details using
XAMPP as a local server. Here’s a step-by-step guide:
Step 1: Set Up Your Environment
1. Install XAMPP: Download and install XAMPP from Apache Friends.
2. Start Apache and MySQL: Open the XAMPP Control Panel and start Apache and
MySQL.
Step 2: Create the Database
1. Open phpMyAdmin: Go to http://localhost/phpmyadmin/.
2. Create a Database: Create a new database named student_portal.
3. Create Tables: Use the following SQL queries to create the necessary tables:
CREATE TABLE student_details (
student_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(100)
);
CREATE TABLE modules (
module_name VARCHAR(100),
class_id INT,
semester INT
);
CREATE TABLE timetable (
module VARCHAR(100),
day VARCHAR(20),
time TIME,
room VARCHAR(50)
);
CREATE TABLE classes (
class_id INT AUTO_INCREMENT PRIMARY KEY,
room VARCHAR(50)
);
CREATE TABLE programs (
program_name VARCHAR(100),
student_id INT,
FOREIGN KEY (student_id) REFERENCES student_details(student_id)
);
Step 3: Create the Web Application
1. Create Project Folder: Create a folder named student_portal in the htdocs directory
of your XAMPP installation.
2. Create HTML and PHP Files: Create the following files in the student_portal folder:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Portal Login</title>
</head>
<body>
<h2>Login</h2>
<form action="login.php" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<input type="submit" value="Login">
</form>
</body>
</html>
login.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "student_portal";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$name = $_POST['name'];
$email = $_POST['email'];
$sql = "SELECT * FROM student_details WHERE first_name='$name' AND
email='$email'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$student_id = $row['student_id'];
$program_sql = "SELECT program_name FROM programs WHERE
student_id='$student_id'";
$program_result = $conn->query($program_sql);
$program = $program_result->fetch_assoc()['program_name'];
$timetable_sql = "SELECT * FROM timetable WHERE module IN (SELECT
module_name FROM modules WHERE class_id IN (SELECT class_id FROM programs
WHERE student_id='$student_id'))";
$timetable_result = $conn->query($timetable_sql);
echo "<h2>Welcome, " . $row['first_name'] . " " . $row['last_name'] .
"</h2>";
echo "<p>Program: " . $program . "</p>";
echo "<p>Semester: " . $row['semester'] . "</p>";
echo "<h3>Timetable</h3>";
echo "<table
border='1'><tr><th>Module</th><th>Day</th><th>Time</th><th>Room</th></tr>";
while ($timetable_row = $timetable_result->fetch_assoc()) {
echo "<tr><td>" . $timetable_row['module'] . "</td><td>" .
$timetable_row['day'] . "</td><td>" . $timetable_row['time'] . "</td><td>" .
$timetable_row['room'] . "</td></tr>";
}
echo "</table>";
} else {
echo "Invalid login credentials.";
}
$conn->close();
?>
Step 4: Test Your Application
1. Access the Application: Open your web browser and go to
http://localhost/student_portal/index.html.
2. Login: Enter the name and email of a student from your database to log in and view their
academic details and timetable.
This should give you a basic web application for students to access their academic details and
timetable. You can further enhance it by adding more features and improving the UI. If you have
any questions or need further assistance, feel free to ask!