SHARE
TWEET

Untitled

a guest Jan 20th, 2020 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.     <head>
  3.         <title>
  4.            
  5.         </title>
  6.     </head>
  7.     <body>
  8.         <form method="post" action="zadatak1.php">
  9.             <label for="ime">Ime filma</label>
  10.             <input type="text" name="imeFilma" id="imeFilma">
  11.         <br>
  12.             <label for="redatelj">Ime redatelja</label>
  13.             <input type="text" name="imeRedatelja" id="imeRedatelja">
  14.             <br>
  15.             <label for="ime">Glavni glumac</label>
  16.             <input type="text" name="imeGlumca" id="imeGlumca">
  17.             <br>
  18.             <label for="zanrovi">┼Żanr</label>
  19.             <select name="zanr">
  20.                   <option  value="AF">Akcija</option>
  21.                   <option value="TR">Triler</option>
  22.                   <option  value="SF">Znanstveno fantasticni</option>
  23.                   <option   value="LJF">Ljubavni</option>
  24.                   <option   value="VS">Vestern</option>
  25.             </select>
  26.             <br>
  27.             <input type="submit" name="submit" value="Dodaj">
  28.         </form>
  29.         <a href="index.php">Povratak na glavnu stranicu</a>
  30.     </body>
  31. </html>
  32.  
  33. <?php
  34.    
  35.     $servername = "localhost";
  36.     $username = "student";
  37.     $password = "student";
  38.     $dbname = "student_database";
  39.    
  40.  
  41.     $conn = new mysqli($servername, $username, $password, $dbname);
  42.  
  43.  
  44.     if ($conn->connect_error) {
  45.         die("Uspostavljanje konekcije na bazu nije uspjelo: ". $conn->connect_error);
  46.     }
  47.     $id = rand(0,100);
  48.  
  49.    
  50.     if(isset($_POST['imeFilma']) && isset($_POST['imeRedatelja']) && isset($_POST['imeGlumca']) && isset($_POST['zanr'])) {
  51.         $sql_query = $conn->prepare("INSERT INTO Film (Id, Ime, Redatelj, Glavni_glumac, Zanr) VALUES (?, ?, ?, ?, ?)");
  52.         $sql_query->bind_param('issss', $id, $_POST['imeFilma'], $_POST['imeRedatelja'], $_POST['imeGlumca'], $_POST['zanr']);
  53.         $sql_query->execute();
  54.         $result = $sql_query->get_result();
  55.     }
  56.    
  57.     $sql_query->close();
  58.    
  59. ?>
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