Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head> <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Form</title> </head> <body> <form method="post"> <label for="Name">Name</label> <input type="text" id="name" name="name"> <label for="Password">Password</label> <input type="password" name="password" id="password"> <input type="submit" name="submit" id="submit"> </form> </body> </html>
- <?php
- if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['submit'])){ if(isset($_POST['name']) && isset($_POST['password'])){ $name = $_POST['name']; $password = $_POST['password']; require('../connect.php'); $query = "INSERT INTO cols (name,password) VALUES (?,?)";
- $stmt = mysqli_prepare($conn,$query);
- mysqli_stmt_bind_param($stmt,"ss", $name, $password);
- $result = mysqli_stmt_execute($stmt);
- if($result = true){
- echo "Sucess";
- }else{
- echo mysqli_error($conn);
- }
- mysqli_close($conn);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement