# Trouble with a script

**URL:** <https://forum.kirupa.com/t/trouble-with-a-script/157526>\
**Category:** Uncategorized\
**Created:** [August 2, 2005, 3:39pm UTC](https://forum.kirupa.com/t/trouble-with-a-script/157526 "2005-08-02T15:39:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haden](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@Haden](https://forum.kirupa.com/u/Haden)\
**Post date:** [August 2, 2005, 3:39pm UTC](https://forum.kirupa.com/t/trouble-with-a-script/157526/1 "2005-08-02T15:39:26Z")

</div>

i’ve recently began using the guestbook tutorial, and i’ve been having problems \>\_\<. i’ve narrowed it out to where the problem is in the code

```auto
 myXML.sendAndLoad("processXML.php", receiverXML); 

```

the targetobject receiverXML has been giving me problems, such as if i try to post it’ll freeze up the flash with the “flash7 slow script” error. everything’s in the right directory, and i can see the test post made by flashmatazz, but there’s no next button as it is standard on his tutorial. if you wish, here’s the rest of my code.

```auto
 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.load("guestbook.xml");
myXML.onLoad = function(success){
myXML.contentType = "text/xml";
if (success){
this.showXML();
}
else{
trace("Error loading XML file");
}
}
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 = "please fill out your name";
Selection.setFocus(this._parent.nameField); 
}
else if (myMessage == ""){
this._parent.errorField.text = "please leave a message";
Selection.setFocus(this._parent.messageField);
}
else {
myXML.firstChild.appendChild(myXML.createElement("entry"));
myXML.firstChild.lastChild.attributes.myName = myName;
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 = "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--){
myGuestbook.htmlText += "<B>" + this.firstChild.childNodes*.attributes.myName + "</B> wrote:
";
myGuestbook.htmlText += this.firstChild.childNodes*.firstChild.firstChild.nodeValue + "

";
}
}
previous.onRelease = function(){ 
currPage--;
myXML.showXML();
next._visible = true;
}
next.onRelease = function(){ 
currPage++;
myXML.showXML();
previous._visible = true;
} 

```

and here’s the PHP processXML.php code

```auto
 <?php
$file = fopen("guestbook.xml", "w+") or die("Can't open XML file");
$xmlString = $HTTP_RAW_POST_DATA; 
if(!fwrite($file, $xmlString)){
	print "Error writing to XML-file";
}
print $xmlString."
";
fclose($file);
?>

```

i’ve tried to figure out what’s wrong, but i can’t seem to get it.
