Jump to content

KW Design

Members
  • Posts

    1
  • Joined

  • Last visited

KW Design's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I threw this together quickly, I thinks its about there, let me know... <html> <head> <title>Create XML</title> </head> <body> <?php if (isset($_POST['Submit'])) { // Collect post data from submitted form $name = $_REQUEST['name']; $val1 = $_REQUEST['val1']; $val2 = $_REQUEST['val2']; $val3 = $_REQUEST['val3']; // Creates a new document according to 1.0 specs $document = domxml_new_doc("1.0"); // Lets create an element and call it root, we will then append it to the new document. $rootElement = $document->create_element($name); $new_node = $document->append_child($rootElement); // Lets create a new node called "Items" and append that to the root node. $itemsElement = $document->create_element("movie"); $items_node = $new_node->append_child($itemsElement); // Now go into a for loop in which we will create, set, and add five nodes to our Items node. $item = $document->create_element("1st"); $item->set_content($val1); $items_node->append_child($item); $item = $document->create_element("2nd"); $item->set_content($val2); $items_node->append_child($item); $item = $document->create_element("3rd"); $item->set_content($val3); $items_node->append_child($item); // Lets dump this structure out to a file called output.xml $document->dump_file("output.xml"); } ?> <form action="" id="form" method="post"> Enter your name and top 3 movies <label>Name:</label><input type="text" name="name" /> <label>1st Place</label><input type="text" name="val1" /> <label>2nd Place</label><input type="text" name="val2" /> <label>3rd Place</label><input type="text" name="val3" /> <input type="submit" name="Submit" value="Submit" /> </form> </body> </html>
  2. I'm Keith from KW Design, I'm a college student and I'm now trying to start my own graphics design company.
×
×
  • Create New...