Advertisement
Guest User

Untitled

a guest
Jul 16th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2. //Categories - EDIT VOOR NIEUWE SKILL!
  3. $categories = array (
  4. 0 => "Arrows",
  5. 1 => "Bows",
  6. 2 => "Bolts",
  7. 3 => "Crossbows",
  8. 4 => "Darts",
  9. 5 => "Other",
  10. );
  11. ?>
  12.  
  13. <html>
  14. <head><title>Method XML-converter</title></head>
  15. <body>
  16. <?php
  17. //verwerk data en display
  18. if (isset($_POST["id"])) {
  19. echo "<textarea cols=100 rows=12>";
  20. //magic happens here
  21. echo " <method>\n";
  22. echo " <id>" . $_POST['id'] . "</id>\n";
  23. echo " <name>" . $_POST['name'] . "</name>\n";
  24. echo " <xp>" . $_POST['xp'] . "</xp>\n";
  25. echo " <level>" . $_POST['level'] . "</level>\n";
  26. echo " <categories>\n";
  27. foreach ($_POST['check_list'] as $check) {
  28. echo " <category>" . $check . "</category>\n";
  29. }
  30. echo " </categories>\n";
  31. echo " </method>\n";
  32. echo "</textarea>";
  33. //var_dump($_POST);
  34. //Uncomment above line for debugging
  35. }
  36. ?>
  37. <form method="POST" action="convert.php">
  38. <table>
  39. <?php
  40. echo "<tr><td>ID</td><td><input type=\"text\" name=\"id\"";
  41. if (isset($_POST['id'])) {
  42. $id = $_POST['id'] + 1;
  43. echo " value=" . $id;
  44. }
  45. echo "></td></tr>";
  46. ?>
  47. <tr><td>Name</td><td><input type="text" name="name"></td></tr>
  48. <tr><td>XP</td><td><input type="text" name="xp"></td></tr>
  49. <tr><td>Level</td><td><input type="text" name="level"></td></tr>
  50. </table>
  51. <?php
  52. foreach($categories as $num => $val) {
  53. echo '<input type="checkbox" name="check_list[]" value="' . $num . '">' . $val . '<br>';
  54. }
  55. ?>
  56. <input type="submit" value="Submit">
  57. </form>
  58. </body>
  59. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement