Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "root";
- $name = "test";
- $link = mysqli_connect($host, $user, $pass, $name);
- session_start();
- if (!empty($_GET)) {
- $surname = $_GET['surname'];
- $name = $_GET['name'];
- $query = "INSERT INTO users (surname,name) VALUES ('$surname','$name')";
- mysqli_query($link, $query) or die(mysqli_error($link));
- $_SESSION['flash'] = 'форма успешно сохранена';
- header('Location: index.php');
- };
- if(isset($_SESSION['flash'])){
- echo $_SESSION['flash'];
- unset($_SESSION['flash']);
- };
- ?>
- <form method="GET">
- <input name="surname" placeholder="Фамилия"></br>
- <input name="name" placeholder="Имя"></br>
- <input type="submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement