forked from earist/3.kodutoo-III-ruhm
/
edit.php
37 lines (28 loc) · 927 Bytes
/
edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once("edit_functions.php");
if(isset($_POST["update_post"])){
// vajutas salvesta nuppu
// numberplate ja color tulevad vormist
// aga id varjatud väljast
updateDream($_POST["id"], $_POST["blog_post"]);
}
if(isset($_GET["edit_id"])){
echo $_GET["edit_id"];
//id oli aadressireal
$dream = getEditData($_GET["edit_id"]);
var_dump($blog);
}else{
echo "VIGA";
//die - edasi lehte ei laeta
//die();
//suuname kasutaja table.php öeheöe
header("Location: table.php");
}
?>
<h2>Muuda unenägu</h2>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" >
<label type="hidden" name="id" value="<?=$_GET["edit_id"];?>">
<label for="blog_post" >Unenäo kirjeldus</label><br>
<input id="blog_post" name="blog_post" type="text" value="<?=$dream->blog_post;?>"> <br><br>
<input type="submit" name="update_post" value="Salvesta">
</form>