Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Register</title>
- </head>
- <body>
- <form action="#" method="POST">
- <h3>Register</h3>
- Username: <input type="text" name="uname"><br>
- Password: <input type="password" name="pass"><br>
- <input type="submit" name="btn">
- </form>
- </body>
- </html>
- <?php
- if (isset($_POST['btn'])) {
- $username = $_POST['uname'];
- $password = $_POST['pass'];
- mysql_connect("localhost","root","");
- mysql_select_db("login2");
- $query = "INSERT INTO users VALUES ('','$username','$password')";
- mysql_query($query);
- echo "Registered Successfully";
- }
- else {
- echo "Failed To Register, Try Again";
- }
- ?>
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- // …
- }
Add Comment
Please, Sign In to add comment