Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Подключение к БД
- $dbh = new PDO('mysql:host=localhost;dbname=testing', 'root', 'root');
- if(isset($_POST['submit'])) {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $data = [
- 'name' => $name,
- 'email' => $email,
- 'subscription_status' => '1',
- ];
- $sql = "INSERT INTO users (name, email, subscription_status) VALUES (:name, :email, :subscription_status)";
- $stmt= $dbh->prepare($sql);
- $stmt->execute($data);
- header( 'Location: succes.php');
- } else {
- exit('Fuck you!');
- }
- ?>
- <!DOCTYPE html>
- <html lang="ru">
- <head>
- <meta charset="UTF-8">
- <title>Подписка на рассылку</title>
- <style>
- .container {
- width: 50%;
- border: 1px solid black;
- margin: 0 auto;
- }
- .form {
- width: 40%;
- margin: 0 auto;
- margin-top: 10%;
- margin-bottom: 10%;
- }
- form {
- padding: 5px;
- }
- input {
- padding: 10px;
- margin: 5px;
- }
- button {
- padding: 10px;
- margin: 5px;
- border: none;
- border-radius: 5px;
- }
- button:hover {
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="form">
- <form method="POST">
- <input type="text" name="name" placeholder="Имя:"><br>
- <input type="text" name="email" placeholder="E-mail:"><br>
- <button type="submit" name="submit">Подписаться</button>
- </form>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment