php repozitar
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.4 KiB

<?php
session_start();
include("init.php");
if(!isset($_SESSION["logged"])){
header("Location: /?error=3"); //error 3 = přístup odepřen
}
if(!isset($_GET["id"])){
header("Location: /?error=4"); //error 4 = špatný vstup
}
$id = $_GET["id"];
$sql = "SELECT * FROM nk_prispevky WHERE id=$id";
$result = mysqli_query($conn,$sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)){
$title = $row["title"];
$id_nk_users = $row["id_nk_users"];
$msg = $row["msg"];
}
} else {
header("Location: /?error=4");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Update</title>
</head>
<body>
<h1>Uprava ID:<?php echo $id?></h1>
<form action="action_update_prispevky.php" method="post">
<?php
echo '<input type="text" hidden name="id" id="id" value="'.$id.'">';
echo '<input type="text" name="title" id="title" value="'.$title.'"> <br>';
echo '<input type="text" name="id_nk_users" id="id_nk_users" value="'.$id_nk_users.'"> <br>';
echo '<textarea name="msg" id="msg" cols="30" rows="10">'.$title.'</textarea>'
?>
<br>
<input type="submit" value="UPDATE">
</form>
</body>
</html>