<?php // Database connection parameters $servername = "localhost"; // Change this to your database server name $username = "your_username"; // Change this to your database username $password = "your_password"; // Change this to your database password $dbname = "your_database_name"; // Change this to your database name // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Check if form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve form data $username = $_POST["username"]; $password = $_POST["password"]; // SQL to insert login info into the database $sql = "INSERT INTO login_info (username, password) VALUES ('$username', '$password')"; if ($conn->query($sql) === TRUE) { echo "Login information inserted successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } } // Close connection $conn->close(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Login Form</title> </head> <body> <h2>Login Form</h2> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> Username: <input type="text" name="username"><br> Password: <input type="password" name="password"><br> <input type="submit" value="Submit"> </form> </body> </html>/* Create Database and Table */ create database crud_db; use crud_db; CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `name` varchar(100), `email` varchar(100), `mobile` varchar(15), PRIMARY KEY (`id`) );