Advertisement
Guest User

Untitled

a guest
Feb 28th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <pre>
  2. <form>
  3. login: <input type='text' name='login'>
  4. haslo: <input type='password' name='haslo'>
  5. imie: <input type='text' name='imie'>
  6. nazwisko: <input type='text' name='nazwisko'>
  7. telefon: <input type='number' name='telefon'>
  8. <input type='submit' name='slij'>
  9. </form>
  10. </pre>
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. <?php
  18. if(isset($_GET['slij']))
  19. {
  20. $login=$_GET['login'];
  21. $haslo=$_GET['haslo'];
  22. $imie=$_GET['imie'];
  23. $nazwisko=$_GET['nazwisko'];
  24. $telefon=$_GET['telefon'];
  25.  
  26. $servername = "localhost";
  27. $username = "root";
  28. $password = "";
  29. $dbname='waluk';
  30. $conn = new mysqli($servername, $username, $password);
  31. if ($conn->connect_error) {
  32. die("niedziala " . $conn->connect_error);
  33. }
  34. else
  35. {
  36. $conn = new mysqli($servername, $username, $password, $dbname);
  37.  
  38. $sql='INSERT INTO osoba (id, login, haslo,imie,nazwisko,telefon)
  39. VALUES ('','.$login.', '.$haslo.','.$imie.','.$nazwisko.','.$telefon.')';
  40. //$sql='INSERT INTO osoba (login)
  41. //VALUEs ('."asddsa".')';
  42. if ($conn->query($sql) === TRUE) {
  43. echo "dodano";
  44. } else {
  45. echo "Error: " . $sql . "<br>" . $conn->error;
  46. }
  47. }
  48. }
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement