# Guestbook

**URL:** <https://forum.kirupa.com/t/guestbook/332072>\
**Category:** Uncategorized\
**Created:** [January 16, 2014, 9:02pm UTC](https://forum.kirupa.com/t/guestbook/332072 "2014-01-16T21:02:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottiescotsman](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@scottiescotsman](https://forum.kirupa.com/u/scottiescotsman)\
**Post date:** [January 16, 2014, 9:02pm UTC](https://forum.kirupa.com/t/guestbook/332072/1 "2014-01-16T21:02:28Z")

</div>

Well I have finished the frame for my first website 🙂 but in trying to add php & MySQL is a little more difficult ☹

Request Entries

[AS]  
import flash.net.URLRequest;  
import flash.net.URLVariables;  
import flash.net.URLLoader;  
import flash.events.Event;  
var variables\_re:URLVariables = new URLVariables();  
var varSend\_re:URLRequest = new URLRequest(“guestbookParse.php”);  
varSend\_re.method = new URLRequestMethod.POST;  
varSend\_re.data = variables\_re;  
var varLoader\_re:URLLoader = new URLLoader;  
varLoader\_re.dataFormat = URLLoaderDataFormat.VARIABLES;  
varLoader\_re.addEventListener(Event.COMPLETE,completeHandler\_re);  
function completeHandler\_re(event:Event):void{  
if(event.target.data.returnBody==""){  
gbOutput\_txt.text=“No data coming through.”  
}else{  
gbOutput\_txt.condenseWhite = true;  
gbOutput\_txt.htmlText = “”+event.target.data.returnBody;  
}  
}  
variables\_re.comType = “requestEntries”;  
varLoader\_re.load(varSend\_re);  
[/AS]

Send Entry

[AS]  
import flash.text.TextFormat;  
import flash.net.URLVariables;  
import flash.net.URLRequest;  
import flash.net.URLLoader;  
import flash.events.Event;  
import flash.events.MouseEvent;  
msg\_txt.restrict = “A-Za-z 0-9”;  
name\_txt.restrict = “A-Za-z 0-9”;  
location\_txt.restrict = “A-Za-z 0-9”;  
var errorsFormat:TextFormat = new TextFormat();  
errorsFormat.color = 0xFF0000;  
processing\_mc.visible = false;  
var variables:URLVariables = new URLVariables();  
var varSend:URLRequest = new URLRequest(“guestbookParse.php”);  
varSend.method = URLRequestMethod.POST;  
varSend.data = variables;  
var varLoader:URLLoader = new URLLoader;  
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;  
varLoader.addEventListener(Event.COMPLETE, completeHandler);  
function completeHandler(event:Event):void{  
processing\_mc.visible = false;  
name\_txt.text = “”;  
location\_txt.text = “”;  
msg\_txt.text = “”;  
status\_txt.text = event.target.data.returnBody;  
gbOutput\_txt.condenseWhite = true;  
gbOutput\_txt.htmlText = “” + event.target.data.returnVody;  
}  
submit\_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);  
function ValidateAndSend(event:MouseEvent):void{  
if(!name\_txt.lenght){  
status\_txt.text = “Please enter your name.”;  
status\_txt.setTextFormat(errorsFormat);  
} else if (!location\_txt.lenght){  
status\_txt.text = “Please enter your location”;  
status\_txt.setTextFormat(errorsFormat);  
} else if (!msg\_txt.lenght){  
status\_txt.text = “Please enter a message.”;  
status\_txt.setTextFormat(errorsFormat);  
} else {  
processing\_mc.visible = true;  
variables.comType = “parseComment”;  
variables.userName = name\_txt.text;  
variables.userLocation = location\_txt.text;  
variables.usrMsg = msg\_txt.text;  
varLoader.load(varSend);  
status\_txt.text = “Waiting for server connection…”;  
}  
}  
[/AS]

hope someone can help 🙂

error codes  
Symbol ‘GUESTBOOK’, Layer ‘SEND.ENTRY.CODE’, Frame 1, Line 32 1119: Access of possibly undefined property lenght through a reference with static type flash.text:TextField.

I got php code as well if you want that … and yes I have set up the db on my webserver
