SHARE
TWEET

Untitled

a guest Jan 14th, 2020 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $conn = mysqli_connect("localhost", "root", "", "laptops");
  3.  
  4. if (isset($_POST['laptop']))
  5. {
  6.  
  7. $ID = $_POST['laptop'];
  8. $Marka = $_POST['brand'];
  9. $Model = $_POST['model'];
  10. $Procesor = $_POST['cpu'];
  11. $Ram = $_POST['ram'];
  12. $Graficka = $_POST['gpu'];
  13. $Zaslon = $_POST['display'];
  14. $HDD = $_POST['hdd'];
  15. $SSD = $_POST['ssd'];
  16. $OS = $_POST['os'];
  17. $Tip = $_POST['type'];
  18. $Težina = $_POST['weight'];
  19. $Baterija = $_POST['battery'];
  20. $Touchscreen = $_POST['tchscreen'];
  21. $Svjetleća_tipkovnica = $_POST['backlit_keys'];
  22. $Kamera = $_POST['camera'];
  23. $Zvucnici = $_POST['speakers'];
  24. $USB = $_POST['usb'];
  25. $HDMI = $_POST['hdmi'];
  26. $Cijena = $_POST['price'];
  27. $Kolicina = $_POST['quantity'];
  28.  
  29.  
  30. $sql = "INSERT INTO laptop (id_laptop, marka_id, laptop_ime, procesor_id, ram, graficka_id, zaslon_id, hdd, ssd, os_id, tip, tezina, baterija, touchscreen, svjetleca_tipkovnica, kamera, zvucnici, usb_portovi, hdmi, cijena, preostala_kolicina)
  31. values ('$ID', '$Marka', '$Model', '$Procesor', '$Ram', '$Graficka', '$Zaslon', '$HDD', '$SSD', '$OS', '$Tip', '$Težina', '$Baterija', '$Touchscreen', '$Svjetleća_tipkovnica', '$Kamera', '$Zvucnici', '$USB', '$HDMI', '$Cijena', '$Kolicina') ";
  32. $result = $conn->query($sql);
  33. //header("location: test.php");
  34.  
  35. }
  36. ?>
  37.  
  38. <html>
  39.     <head>
  40.         <!-- Latest compiled and minified CSS -->
  41. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  42.  
  43. <!-- jQuery library -->
  44. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  45.  
  46. <!-- Popper JS -->
  47. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  48.  
  49. <!-- Latest compiled JavaScript -->
  50. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
  51.  
  52. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  53.     <link rel="stylesheet" type="text/css" href="index.css">
  54.     </head>
  55.     <body>
  56.     <h1>
  57.                 Laptop Selector
  58.             </h1>
  59.        
  60.             <ul>
  61.                 <li><a  href="pocetna.php">Home</a></li>
  62.                 <li><a class="active" href="test.php">Laptopi</a></li>
  63.                 <li><a href="proizvodaci.php">Proizvođaći</a></li>
  64.                 <li><a href="gaming.php">Gaming laptopi</a></li>
  65.                 <li><a href="search.php">Tražilica</a></li>
  66.                 <li><a href="shop.php">Kupovina</a></li>
  67.               </ul>
  68.               <br>
  69.     </body>
  70. </html>
  71.  
  72. <form method="post">
  73.  
  74. <table>
  75.     <tbody>
  76.     <tr>
  77.     <td>ID:</td>
  78.     <td><input type="text" name="laptop"><br></td>
  79.     </tr>
  80.     <tr>
  81.     <td>Marka:</td>
  82.     <td><input type="text" name="brand"><br></td>
  83.     </tr>
  84.     <tr>
  85.     <td>Model:</td>
  86.     <td><input type="text" name="model"><br></td>
  87.     </tr>
  88.     <tr>
  89.     <td>Procesor:</td>
  90.     <td><input type="text" name="cpu"><br></td>
  91.     </tr>
  92.     <tr>
  93.     <td>Ram:</td>
  94.     <td><input type="text" name="ram"><br></td>
  95.     </tr>
  96.     <tr>
  97.     <td>Graficka:</td>
  98.     <td><input type="text" name="gpu"><br></td>
  99.     </tr>
  100.     <tr>
  101.     <td>Zaslon:</td>
  102.     <td><input type="text" name="display"><br></td>
  103.     </tr>
  104.     <tr>
  105.     <td>HDD(GB):</td>
  106.     <td><input type="text" name="hdd"><br></td>
  107.     </tr>
  108.     <tr>
  109.     <td>SSD(GB):</td>
  110.     <td><input type="text" name="ssd"><br></td>
  111.     </tr>
  112.     <tr>
  113.     <td>OS:</td>
  114.     <td><input type="text" name="os"><br></td>
  115.     </tr>
  116.     <tr>
  117.     <td>Tip:</td>
  118.     <td><input type="text" name="type"><br></td>
  119.     </tr>
  120.     <tr>
  121.     <td>Težina(KG:</td>
  122.     <td><input type="text" name="weight"><br></td>
  123.     </tr>
  124.     <tr>
  125.     <td>Baterija(Wh):</td>
  126.     <td><input type="text" name="battery"><br></td>
  127.     </tr>
  128.     <tr>
  129.     <td>Touchscreen:</td>
  130.     <td><input type="text" name="tchscreen"><br></td>
  131.     </tr>
  132.     <tr>
  133.     <td>Svjetleća tipkovnica:</td>
  134.     <td><input type="text" name="backlit_keys"><br></td>
  135.     </tr>
  136.     <tr>
  137.     <td>Kamera:</td>
  138.     <td><input type="text" name="camera"><br></td>
  139.     </tr>
  140.     <tr>
  141.     <td>Zvucnici:</td>
  142.     <td><input type="text" name="speakers"><br></td>
  143.     </tr>
  144.     <tr>
  145.     <td>USB portovi:</td>
  146.     <td><input type="text" name="usb"><br></td>
  147.     </tr>
  148.     <tr>
  149.     <td>HDMI:</td>
  150.     <td><input type="text" name="hdmi"><br></td>
  151.     </tr>
  152.     <tr>
  153.     <td>Cijena:</td>
  154.     <td><input type="text" name="price"><br></td>
  155.     </tr>
  156.     <tr>
  157.     <td>Preostala količina:</td>
  158.     <td><input type="text" name="quantity"><br></td>
  159.     </tr>
  160.     </tbody>
  161.  
  162. </table>
  163. <br>
  164. <input type="submit">
  165. </form>
  166.  
  167. <?php
  168. if (isset($_POST['laptop']))
  169. {
  170.  
  171. if($Kolicina > 20){
  172.     echo "<div class=\"alert alert-danger alert-dismissible\">
  173.     <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>
  174.     <strong>Pozor!</strong> Prevelika količina. Maksimalno 20 komada!
  175.   </div>";
  176. }
  177. else{
  178.     echo "<div class=\"alert alert-success alert-dismissible\">
  179.         <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>
  180.         <strong>Uspjesno dodano!</strong>
  181.       </div>";
  182. }
  183. }
  184.  
  185. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top