PJF16

Quiz

Jun 8th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.55 KB | None | 0 0
  1. //admin.php
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>Adminbereich</title>
  8. </head>
  9.  
  10. <form action="checked.php" method = "POST">
  11. Index: <input type= "text" name="index" />
  12. Frage: <input type="text" name="frage" />
  13. Antwort 1: <input type="text" name="a1" />
  14. Antwort 2: <input type="text" name="a2" />
  15. Antwort 3: <input type="text" name="a3" />
  16. Antwort 4: <input type="text" name="a4" />
  17. Richtige Antwort: <input type="text" name="ra" />
  18. <input type="submit" />
  19. </form>
  20.  
  21. <body>
  22. </body>
  23. </html>
  24.  
  25. //checked.php
  26.  
  27. <head>
  28. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  29. <title>Unbenanntes Dokument</title>
  30.  
  31. <link href="style.css" rel="stylesheet" type="text/css" />
  32. </head>
  33. <h1>Frage eingefügt!</h1>
  34.  
  35. <?php
  36. $_POST ['index'] = $index;
  37. $_POST ['frage'] = $frage;
  38. $_POST ['a1'] = $a1;
  39. $_POST ['a2'] = $a2;
  40. $_POST ['a3'] = $a3;
  41. $_POST ['a4'] = $a4;
  42. $_POST ['ra'] = $ra;
  43.  
  44.  
  45.  
  46. $con = mysql_connect("localhost","root");
  47. if (!$con)
  48.   {
  49.   die('Could not connect: ' . mysql_error());
  50.   }
  51.   mysql_select_db("quiz", $con);
  52. mysql_query("INSERT INTO `fragen`(`index`, `Frage`, `Antwort1`, `Antwort2`, `Antwort3`, `Antwort4`, `Richtige Antwort`) VALUES ($index,$a1,$a2,$3,$a4,$ra)");
  53. mysql_close ($con);
  54. ?>
  55.  
  56. <form style="text-align: center;" action="index.php">
  57. <input type="submit" name"Startseite"/>
  58. <body>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment