Guest User

Untitled

a guest
Jul 28th, 2020
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. // Подключение к БД
  2. $dbh = new PDO('mysql:host=localhost;dbname=testing', 'root', 'root');
  3.  
  4. if(!empty($_POST['name'] && $_POST['email'])) {
  5. $name = $_POST['name'];
  6. $email = $_POST['email'];
  7.  
  8. $data = [
  9. 'name' => $name,
  10. 'email' => $email,
  11. 'subscription_status' => '1',
  12. ];
  13.  
  14. $sql = "INSERT INTO users (name, email, subscription_status) VALUES (:name, :email, :subscription_status)";
  15. $stmt= $dbh->prepare($sql);
  16. $stmt->execute($data);
  17. header( 'Location: succes.php');
  18. }
Advertisement
Add Comment
Please, Sign In to add comment