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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.