Create the Database and Table in PhpMyAdmin
Create the Database and Table in PhpMyAdmin
Click on the newly created database name (e.g., studentdb) from the left panel.
Under "Create table", enter:
o Table name: students
o Number of columns: 3
Click Go
Then:
✅ Table students is now created with columns: id, name, and email.
2. HTML + CSS Form (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Insert Student</title>
<style>
form { background: white; padding: 20px; border-radius: 5px; width: 300px; margin: auto; }
input[type="text"], input[type="email"] {
width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #ccc;
input[type="submit"] {
background: #4CAF50; color: white; padding: 10px; border: none; width: 100%;
cursor: pointer;
</style>
</head>
<body>
<label>Name:</label>
</form>
</body>
</html>
<?php
// Database configuration
$servername = "localhost";
$username = "root";
$password = ""; // default password in XAMPP is empty
$dbname = "studentdb";
// Create connection
$conn = new mysqli($servername, $username, $password,
$dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$conn->close();
?>
▶️How to Run: