Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8.     <title>Document</title>
  9. </head>
  10.  
  11. <body>
  12.     <?php
  13.     $serwer = "localhost";
  14.     $login = "root";
  15.     $haslo = "";
  16.     $baza = 'klasa';
  17.     $tabela = 'uczen';
  18.  
  19.     $conn = mysqli_connect($serwer, $login, $haslo, $baza);
  20.  
  21.     ?>
  22.     <form method="post">
  23.         <input type="text" name="id" id="">
  24.         <input type="text" name="name" id="">
  25.         <input type="text" name="surname" id="">
  26.         <input type="text" name="address" id="">
  27.         <input type="submit" value="">
  28.     </form>
  29.  
  30.     <?php
  31.  
  32.     $id = $_POST['id'];
  33.     $name = $_POST['name'];
  34.     $surname = $_POST['surname'];
  35.     $address = $_POST['address'];
  36.  
  37.     $sql = " UPDATE uczen SET name='$name', surname='$surname', address='$address' WHERE idUcznia='$id'";
  38.  
  39.     if (mysqli_query($conn, $sql)) {
  40.         echo "Record updated successfully";
  41.     } else {
  42.         echo "Error updating record: " . mysqli_error($conn);
  43.     }
  44.     mysqli_close($conn);
  45.  
  46.     ?>
  47. </body>
  48.  
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement