Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once ('zdroje/init.php');
- ?>
- <html>
- <head>
- <meta charset = 'utf-8'>
- <style>
- label {display:block;}
- </style>
- <title> Pridani Clanku</title>
- </head>
- <body>
- <h1> Pridani Clanku </h1>
- <form action = "" method="post">
- <div>
- <label for = "Titulek"> Titulek </label>
- <input type = "text" name="nazev">
- </div>
- <div>
- <label for = "Clanek"> Clanek </label>
- <textarea name= "text" rows="15" cols= "50"></textarea>
- </div>
- <div>
- <label for = "Kategorie"> Kategorie </label>
- <select name = "kategorie">
- <?php
- include_once('func/blog.php');
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "blog";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT id,nazev FROM kategorie";
- $result = $conn->query($sql);
- $row = $result->fetch_assoc();
- ?>
- <?php
- while($row = $result->fetch_assoc()) {
- ?>
- <option value = "<?php echo " Name: " . $row["id"]. ";"?>">
- <?php
- echo " Name: " . $row["nazev"]. "";
- }
- ?>
- </option>/n
- </select>
- </div>
- <div>
- <input type="submit" value="Pridej kategorii">
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement