devdavad Posted December 12, 2008 Share Posted December 12, 2008 I'm working on another calendar app for php 4.3.11 on a windows server and I'm having trouble with some of the php4 dom xml functions. Here the editing xml part of the code I'm working on... <?php ... if(isset($_POST["event"], $_POST["year"], $_POST["desc"]) == True and $postingas != "notallowed") { # check that the xml file is not null if(!file_get_contents($xml) == null) { $dom = domxml_open_mem(file_get_contents($xml, $error)); $event = $dom->create_element("event"); $event->set_attribute("title", $_POST["event"]); $posted = $dom->create_element("posted"); $posted->set_attribute("by", $_POST["user"]); $posted->set_attribute("at", strftime("%D %I:%M:%S %p")); $date = $dom->create_element("date"); $date->set_content(date("l", $postedtimestamp) . " the " . date("d", $postedtimestamp) . " of " . $_POST["month"] . ", " . $_POST["year"] . " at " . $_POST["hour"] . ":" . $_POST["minute"] . " " . $_POST["ampm"]); $desc = $dom->create_element("desc"); $desc->set_content("<![CDATA[" . $_POST["desc"] . "]]>"); $event->append_child($posted); $event->append_child($date); $event->append_child($desc); $calendar = $dom->document_element(); $calendar->append_child($event); file_put_contents($xml, $dom->dump_mem()); echo "job completed"; } else { echo "calendar has been blanked"; } } else { echo "please fill out all fields in the form"; } ?> Anyway, the script never gets to the statement echo "job completed" or at least it never prints it (but I am certain that it gets to that part of the if). I'm also not for sure how I can get the xml stuff to execute until there's an error and then print the $error array from line 6. But for now only a blank page is shown when I execute it. Quote Link to comment Share on other sites More sharing options...
devdavad Posted December 12, 2008 Author Share Posted December 12, 2008 Update: Alright, so if I change the line file_put_contents($xml, $dom->dump_mem()); to $dom->dump_file($xml); the script finishes executing but it doesn't actually change the xml file at all. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.