Advertisement
Guest User

Untitled

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