View difference between Paste ID: xUL1UrjT and FjRjsG5D
SHOW: | | - or go back to the newest paste.
1
//admin.php
2
3
4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
<html xmlns="http://www.w3.org/1999/xhtml">
6
<head>
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
<title>Adminbereich</title>
9
</head>
10
11
<form action="checked.php" method = "POST">
12
Index: <input type= "text" name="index" />
13
Frage: <input type="text" name="frage" />
14
Antwort 1: <input type="text" name="a1" />
15
Antwort 2: <input type="text" name="a2" />
16
Antwort 3: <input type="text" name="a3" />
17
Antwort 4: <input type="text" name="a4" />
18-
<input type="submit" />
18+
19
<input type="submit" name="set" />
20
</form>
21
22
<body>
23
</body>
24
</html>
25
26
//checked.php
27
28
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
29
<html xmlns="http://www.w3.org/1999/xhtml">
30
<head>
31
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
32
<title>Unbenanntes Dokument</title>
33
34
<link href="style.css" rel="stylesheet" type="text/css" />
35
</head>
36
<h1>Frage eingefügt!</h1>
37
38
39
<?php
40
41
42
$_POST ['index'] = $index;
43
$_POST ['frage'] = $frage;
44
$_POST ['a1'] = $a1;
45
$_POST ['a2'] = $a2;
46
$_POST ['a3'] = $a3;
47
$_POST ['a4'] = $a4;
48
$_POST ['ra'] = $ra;
49
50
51
52-
mysql_query("INSERT INTO `fragen`(`index`, `Frage`, `Antwort1`, `Antwort2`, `Antwort3`, `Antwort4`, `Richtige Antwort`) VALUES ($index,$a1,$a2,$3,$a4,$ra)");
52+
53
if (!$con)
54
  {
55
  die('Could not connect: ' . mysql_error());
56
  }
57-
<input type="submit" name"Startseite"/>
57+
58
if (isset($_POST['set'])) {
59
mysql_query("INSERT INTO `fragen`(`index`, `Frage`, `Antwort1`, `Antwort2`, `Antwort3`, `Antwort4`, `Richtige Antwort`) VALUES ($index,$frage,$a1,$a2,$3,$a4,$ra)");
60
}
61
mysql_close ($con);
62
?>
63
64
<form style="text-align: center;" action="index.php">
65
<input type="submit" name="Startseite"/>
66
<body>
67
</body>
68
</html>