Jump to content

php4 dom xml functions


devdavad

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/136615-php4-dom-xml-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.