Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['formsub'])) {
- $username = $_POST['user'];
- $password = $_POST['pass'];
- $pdo = new PDO("mysql:host=localhost;dbname=database", 'username', 'password');
- $query = $pdo->prepare("INSERT INTO users (user,pass) VALUES (:user,:pass)");
- $values = array(
- "user" => $username,
- "pass" => $password
- );
- $query->execute($values);
- }
- ?>
- <form action="index.php" method="post">
- username: <input type="text" name="user"><br>
- password: <input type="password" name="pass"><br>
- <input type="hidden" name="formsub" value="1">
- <input type="submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement