View difference between Paste ID: fdYAnEJF and xUL1UrjT
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
Richtige Antwort: <input type="text" name="ra" />
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;
42+
$index=$_POST ['index'];
43-
$_POST ['frage'] = $frage;
43+
$frage=$_POST ['frage'];
44-
$_POST ['a1'] = $a1;
44+
$a1=$_POST ['a1'];
45-
$_POST ['a2'] = $a2;
45+
$a2=$_POST ['a2'];
46-
$_POST ['a3'] = $a3;
46+
$a3=$_POST ['a2'];
47-
$_POST ['a4'] = $a4;
47+
$a4=$_POST ['a4'];
48-
$_POST ['ra'] = $ra;
48+
$ra=$_POST ['ra'];
49
50
51
$con = mysql_connect("localhost","root");
52
if (!$con)
53
  {
54
  die('Could not connect: ' . mysql_error());
55
  }
56
  mysql_select_db("quiz", $con);
57
if (isset($_POST['set'])) {
58
mysql_query("INSERT INTO `fragen`(`index`, `Frage`, `Antwort1`, `Antwort2`, `Antwort3`, `Antwort4`, `Richtige Antwort`) VALUES ($index,$frage,$a1,$a2,$3,$a4,$ra)");
59
}
60
mysql_close ($con);
61
?>
62
63
<form style="text-align: center;" action="index.php">
64
<input type="submit" name="Startseite"/>
65
<body>
66
</body>
67
</html>