View difference between Paste ID: 2jsisFLi and txPfFqbs
SHOW: | | - or go back to the newest paste.
1
<!DOCTYPE html>
2
<html>
3
  <head>
4
	<meta charset="UTF-8">
5
 
6
    <title>Vieraskirja</title>
7
  </head>
8
  <body>
9
  <h1>Studion Vieraskirja</h1>
10
  
11
  
12
  
13
<?php
14
15
include ("../yhteys.php");
16
include ("../vieraskirja.php");
17
18
$nimi=$_POST["nimi"];
19
$viesti=$_POST["viesti"];
20
$hyvaksytty=$_POST["hyvaksytty"];
21
22
$comment=new Kommentti();
23
$comment->setNimi($nimi);
24
$comment->setViesti($viesti);
25
$comment->setHyvaksytty($hyvaksytty);
26
27
28
29
set_error_handler("anyError", E_ALL);
30
31
32
$result=mysqli_query($yhteys,"select * from jesse1710_vieraskirja");
33
print "<table>";
34
35
while($rivi=mysqli_fetch_object($result)){
36
	print "<tr>"; print "<form action='moderointi.php' method='post'>";
37-
				print "<input type='hidden' value='155'>";
37+
// Tähän lisätty $rivi["id"], niin tulee dynaamisesti id
38
				print "<input type='hidden' value='<?php echo $rivi["id"] ?>'>";
39-
				print "</form>";</tr>";
39+
40
				print "</form>";
41
// Tähän korjattu print virhe			
42
print "</tr>";
43
	
44
}
45
46
print "</table>";
47
48
49
50
mysqli_stmt_close($stmt);
51
mysqli_close($yhteys);
52
53
54
exit;
55
?>
56
57
<?php
58
function anyError($level, $message){
59
	print "function anyError".$message;
60
}
61
?>
62
</body>
63
</html>