tried to follow a tutorial for creating a guestbook in flash. Well, I think i did everything right, but when i test the page, I can’t get the submitted text to display :-\ have rechecked so many times i can0t find the mistake… hope one of you guys would be nice enough to give me a hand and help me find my mistake.
Gave the .fla and .php script along.
on (release) {
if (Name eq "") {
Status = "Please enter your name";
} else if (Email eq "") {
Status = "Please enter email Address";
} else if (Website eq "") {
Status = "Please enter the URL to your website";
} else {
Submit = "Yes";
NumHigh = 10;
NumLow = 0;
GuestBook = "Processing.. Loading New... ";
loadVariablesNum("GuestBook.php", 0, "POST");
Status = "Your entry has been submitted. ";
gotoAndStop(3);
}
}
Is there anything written in the text file? if not then that means that the php script isn’t even running at all, which means that its not retrieving the variables, which means you have to do what I said above.
If the text file has anything written in it, then I don’t know I woul dhave to take another look at the code. Did you try what I suggested? that might work… its probably just a problem with the php because:
The newer versions of PHP have global variables turned off, so you need to use the $_POST or $_GET array to grab them from the previous page/swf file.
With the Release of PHP 4.1.0 Their have been some additional updates that should be taken into consideration for future use of PHP. In previous versions all PHP variables where available in whatever form they came to the script in, and where automatically declared in the script. For example if you sent the script the variable ‘Name’ from Posting the contents of a form, attached to the end of a URL string, from a cookie, as a session variable, etc that variable is/was automatically available for use in the script (as long as register_globals was turned on). With the release of PHP 4.1.0 you will now have to grab the value from a special array variable:
$_GET - contains form variables sent through GET
$_POST - contains form variables sent through POST
$_COOKIE - contains HTTP cookie variables
$_SERVER - contains server variables (e.g., REMOTE_ADDR)
$_ENV - contains the environment variables
$_REQUEST - a merge of the GET variables, POST variables and Cookie variables.
$_SESSION - contains HTTP variables registered by the session module
For example in the above script. Instead of being able to just use the variable ‘Name’ from the Flash form - we would have to use something like - <? $Name = $_POST[“Name”]; … … ?> - Fortunately the above script used in this tutorial still work for now. But it might be a good idea to get into the practice of using the new method. It is also a more secure method of programming with PHP. To learn more visit www.php.net.
Just copy and paste that code. I don’t know why those number lines were in there (either you put them there, or your editor did) but you can’t have them their. They cause a parse error and that is probably what was causing the problem.
Place Guestbook.php, GuestBook.txt and your SWF file all in the same folder. Make sure that the TEXT file is CHMODed to 777 and you should be all set. it looks like it should work fine.
pasted the code u gave me, now it does write data on the .txt, thx, but it still doesn’t show it live… arrrgg… i’ll check again my fla, there must be a problem there too…