-- -- Table structure for table `user_registration` -- CREATE TABLE `user_registration` ( `user_id` INT(11) NOT NULL, `first_name` VARCHAR(100) NOT NULL, `last_name` VARCHAR(100) NOT NULL, `user_name` VARCHAR(100) NOT NULL, `password` VARCHAR(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
<?php $db_server = "localhost"; $db_username = "root"; $db_password = ""; $db_database = "registration_pdo"; $conn = new PDO("mysql:host=$db_server;dbname=$db_database", $db_username, $db_password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); ?>
<?php $db_server = "localhost"; $db_username = "root"; $db_password = ""; $db_database = "registration_pdo"; $first_name=$_POST['first_name']; $last_name=$_POST['last_name']; $user_name=$_POST['user_name']; $password1=$_POST['password']; $conn = new PDO("mysql:host=$db_server;dbname=$db_database", $db_username, $db_password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO user_registration (first_name, last_name, user_name, password) VALUES ('$first_name', '$last_name', '$user_name', '$password1')"; echo "<script>alert('Account successfully added!'); window.location='index.php'</script>"; ?>
<style type="text/css"> body { width:600px; border:red 1px solid; border-style:dashed; margin:auto; padding:10px; } td { text-align:center; padding:10px; } table { margin:auto; } input[type="text"] { width:150px; font-size: 18px; border: blue 1px solid; text-indent: 5px; cursor:pointer; } input[type="password"] { width:150px; font-size: 18px; border: blue 1px solid; text-indent: 5px; cursor:pointer; } label { font-size:18px; color:blue; font-weight: bold; font-family: cursive; } h2 { color:red; text-align:center; } .submit_btn { margin-right: 70px; border: blue 1px solid; font-size: 18px; font-family: cursive; padding: 5px; font-weight: bold; color: blue; background: azure; border-radius: 4px; } .submit_btn:hover { margin-right: 70px; border: red 1px solid; font-size: 18px; font-family: cursive; padding: 5px; font-weight: bold; color: white; background: blue; border-radius: 4px; cursor:pointer; } .cancel_btn { border: red 1px solid; font-size: 18px; font-family: cursive; padding: 5px; font-weight: bold; color: red; background: azure; border-radius: 4px; } .cancel_btn:hover { border: blue 1px solid; font-size: 18px; font-family: cursive; padding: 5px; font-weight: bold; color: white; background: red; border-radius: 4px; cursor:pointer; } </style>