ACTIVITY-NO.1-3
ACTIVITY-NO.1-3
1
MAKE A DATABASE AND TABLE
USE my_database;
);
LOGIN FORM
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<style>
body {
margin: 0;
padding: 0;
background: linear-gradient(135deg, #74ebd5, #ACB6E5);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.login-box {
background-color: #ffffff;
padding: 40px 30px;
border-radius: 15px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
width: 320px;
text-align: center;
}
.login-box h2 {
margin-bottom: 25px;
color: #333;
}
.login-box label {
display: block;
text-align: left;
margin: 10px 0 5px;
font-weight: bold;
color: #555;
}
.login-box input[type="text"],
.login-box input[type="password"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 8px;
margin-bottom: 15px;
font-size: 14px;
}
.login-box input[type="submit"] {
width: 100%;
padding: 12px;
background-color: #007BFF;
border: none;
color: white;
font-size: 16px;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.login-box input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="login-box">
<h2>Login</h2>
<form action="database_login.php" method="post">
<label for="username">Username:</label>
<input type="text" name="username" required>
<label for="password">Password:</label>
<input type="password" name="password" required>
</body>
</html>
ACTIVITY NO.3
DATABASE CONNECTION
Database Connection
<?php
// Define your database connection parameters
$servername = "localhost";
$username = "root";
$password = ""; // default is blank for local servers
$dbname = "my_database";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if (!$conn->connect_error) {
echo "Connected successfully!";
}
?>
Remember:
http://localhost/yourfolder/basic_info.html