Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Categories - EDIT VOOR NIEUWE SKILL!
- $categories = array (
- 0 => "Bury",
- 1 => "Gilded altar, 2 burners lit",
- 3 => "Ectofuntus",
- /* FLETCHING
- 0 => "Arrows",
- 1 => "Bows",
- 2 => "Bolts",
- 3 => "Crossbows",
- 4 => "Darts",
- 5 => "Dungeoneering",
- 6 => "Other",
- */
- );
- ?>
- <html>
- <head><title>Method XML-converter</title></head>
- <body>
- <?php
- //verwerk data en display
- if (isset($_POST["id"])) {
- echo "<textarea cols=100 rows=12>";
- //magic happens here
- echo " <method>\n";
- echo " <id>" . $_POST['id'] . "</id>\n";
- echo " <name>" . $_POST['name'] . "</name>\n";
- echo " <xp>" . $_POST['xp'] . "</xp>\n";
- echo " <level>" . $_POST['level'] . "</level>\n";
- echo " <categories>\n";
- foreach ($_POST['check_list'] as $check) {
- echo " <category>" . $check . "</category>\n";
- }
- echo " </categories>\n";
- echo " </method>\n";
- echo "</textarea>";
- //var_dump($_POST);
- //Uncomment above line for debugging
- }
- ?>
- <form method="POST" action="convert.php">
- <table>
- <?php
- echo "<tr><td>ID</td><td><input type=\"text\" name=\"id\"";
- if (isset($_POST['id'])) {
- $id = $_POST['id'] + 1;
- echo " value=" . $id;
- }
- echo "></td></tr>";
- ?>
- <tr><td>Name</td><td><input type="text" name="name"></td></tr>
- <tr><td>XP</td><td><input type="text" name="xp"></td></tr>
- <tr><td>Level</td><td><input type="text" name="level"></td></tr>
- </table>
- <?php
- foreach($categories as $num => $val) {
- echo '<input type="checkbox" name="check_list[]" value="' . $num . '"';
- if (isset($_POST['check_list'])) {
- foreach ($_POST['check_list'] as $check) {
- if ($num == $check) { echo " checked"; }
- }
- }
- echo '>' . $val . '<br>';
- }
- ?>
- <input type="submit" value="Submit">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement