Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>
- </title>
- </head>
- <body>
- <form method="post" action="zadatak1.php">
- <label for="ime">Ime filma</label>
- <input type="text" name="imeFilma" id="imeFilma">
- <br>
- <label for="redatelj">Ime redatelja</label>
- <input type="text" name="imeRedatelja" id="imeRedatelja">
- <br>
- <label for="ime">Glavni glumac</label>
- <input type="text" name="imeGlumca" id="imeGlumca">
- <br>
- <label for="zanrovi">Žanr</label>
- <select name="zanr">
- <option value="AF">Akcija</option>
- <option value="TR">Triler</option>
- <option value="SF">Znanstveno fantasticni</option>
- <option value="LJF">Ljubavni</option>
- <option value="VS">Vestern</option>
- </select>
- <br>
- <input type="submit" name="submit" value="Dodaj">
- </form>
- <a href="index.php">Povratak na glavnu stranicu</a>
- </body>
- </html>
- <?php
- $servername = "localhost";
- $username = "student";
- $password = "student";
- $dbname = "student_database";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Uspostavljanje konekcije na bazu nije uspjelo: ". $conn->connect_error);
- }
- $id = rand(0,100);
- if(isset($_POST['imeFilma']) && isset($_POST['imeRedatelja']) && isset($_POST['imeGlumca']) && isset($_POST['zanr'])) {
- $sql_query = $conn->prepare("INSERT INTO Film (Id, Ime, Redatelj, Glavni_glumac, Zanr) VALUES (?, ?, ?, ?, ?)");
- $sql_query->bind_param('issss', $id, $_POST['imeFilma'], $_POST['imeRedatelja'], $_POST['imeGlumca'], $_POST['zanr']);
- $sql_query->execute();
- $result = $sql_query->get_result();
- }
- $sql_query->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement