Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- </head>
- <body>
- <form method="POST" action="x.php">
- <input type='text' name='imie'>Podaj imie <br>
- <input type='e-mail' name='e_mail'>Podaj e-mail<br>
- <input type='text' name='haslo'>Podaj haslo <br>
- <input type='text' name='wiek'>Podaj wiek<br>
- <button>Wyślij</button>
- <button type='reset'>Zresetuj</button>
- </form>
- </body>
- </html>
- // NOWY PLIK Z PHP
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $DB = "ogloszenia";
- $conn = new mysqli($servername,$username,$password,$DB);
- $imie=$_POST['imie'];
- $e_mail=$_POST['e_mail'];
- $haslo=$_POST['haslo'];
- $wiek=$_POST['wiek'];
- if($conn->connect_error){
- echo 'Błąd z połączeniem z bazą danych '.$DB;
- }else{
- if($imie !=''){
- echo 'Dodano poprawnie rekordy do bazy';
- $sql="INSERT INTO `userss` (`ID`, `name`, `e_mail`, `password`, `old`) VALUES (NULL, '".$imie."', '".$e_mail."', '".$haslo."',
- '".$wiek."')";
- $conn->query($sql);
- }else{
- echo 'Wystąpił bląd z zmiennymi do dodania.';
- }
- $conn->close();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement