XML Guestbook with PHP - how to add date

After doing Flashmatazz’s excellent Flash guestbook tutorial I thought it would be nice to get the time and date recorded as well.

I searched the forum and found this thread, but that code for some reason only managed to show the current time on all the entries. I played around for a while with the code and finally I got it working! (but I must say I don’t know exactly what I did).

So here’s the code for anyone whos interested. I’ve also removed the **formatting and replaced it with color formatting for those who want to use pixel fonts.

Guess this is not the best solution, but it works.

 
var currPage = 0;
var showAmount = 10;
// set this to the amount of entries you want to view at a time
previous._visible = false;
createMessage._visible = false;
createButton.onRelease = function() {
 this._visible = false;
 this._parent.createMessage._visible = true;
 if (createMessage.nameField.text == "") {
  Selection.setFocus(createMessage.nameField);
 } else if (createMessage.messageField.text == "") {
  Selection.setFocus(createMessage.messageField);
 }
};
// **** Load XML ****************************
myXML = new XML();
myXML.ignoreWhite = true;
receiverXML = new XML();
myXML.onLoad = function(success) {
 myXML.contentType = "text/xml";
 if (success) {
  this.showXML();
 } else {
  trace("Error loading XML file");
 }
};
myIdentifier = Math.round(Math.random()*10000);
myXML.load("guestbook.xml?uniq="+myIdentifier);
receiverXML.onLoad = function() {
 this.contentType = "text/xml";
 _root.currPage = 0;
 this.showXML();
};
createMessage.closeButton.onRelease = function() {
 this._parent._visible = false;
 createButton._visible = true;
};
createMessage.sendButton.onRelease = function() {
 var myName = this._parent.nameField.text;
 var myMessage = this._parent.messageField.text;
 if (myName == "") {
  this._parent.errorField.text = "NAME PLEASE";
  Selection.setFocus(this._parent.nameField);
 } else if (myMessage == "") {
  this._parent.errorField.text = "MESSAGE PLEASE";
  Selection.setFocus(this._parent.messageField);
 } else {
  myXML.firstChild.appendChild(myXML.createElement("entry"));
	 myXML.firstChild.lastChild.attributes.myName = myName;
  myXML.firstChild.lastChild.attributes.myDate = myDate;
  myXML.firstChild.lastChild.appendChild(myXML.createElement("myText"));
  myXML.firstChild.lastChild.lastChild.appendChild(myXML.createTextNode(myMessage));
  myXML.sendAndLoad("processXML.php", receiverXML);
  this._parent._visible = false;
  createButton._visible = true;
 }
};
XML.prototype.showXML = function() {
 myGuestbook.scroll = 1;
 myGuestbook.htmlText = "";
 var numItems = this.firstChild.childNodes.length;
 var firstItem = numItems-(currPage*showAmount);
 if (currPage == 0) {
  previous._visible = false;
 }
 var lastItem = firstItem-showAmount;
 if (lastItem<=0) {
  lastItem = 0;
  next._visible = false;
 }
 myCount.text = "Total messages: "+numItems;
 if (firstItem == lastItem+1) {
  nowShowing.text = "Showing message "+firstItem;
 } else {
  nowShowing.text = "Showing message "+firstItem+" to "+(lastItem+1);
 }
 for (i=(firstItem-1); i>=lastItem; i--) {
 }
 myDate = new Date();
 myHour = myDate.getHours();
 myMinute = myDate.getMinutes();
 myDay = myDate.getDate();
 myMonth = myDate.getMonth();
 myYear = myDate.getFullYear();
 for (i=(firstItem-1); i>=lastItem; i--) {
  myGuestbook.htmlText += "<font color='#ff3399'>"+this.firstChild.childNodes*.attributes.myDate+"  </font> 
";
  myGuestbook.htmlText += "<font color='#ff3399'>"+this.firstChild.childNodes*.attributes.myName+" wrote:</font> 
";
  myGuestbook.htmlText += this.firstChild.childNodes*.firstChild.firstChild.nodeValue+"
";
	 myGuestbook.htmlText +="<br>
";
 }
  
 
};
previous.onRelease = function() {
 currPage--;
 myXML.showXML();
 next._visible = true;
};
next.onRelease = function() {
 currPage++;
 myXML.showXML();
 previous._visible = true;
};