PDA

View Full Version : Old topic but anyways!


labrat
10-29-2003, 04:04 PM
I know this has been dicussed in some detail before, but I tried it and it never worked for me. I'm attempting to post form data to a php script which, in turn, writes the data to a text file.

Here's my actioscript:

on (release) {
writeLVs = new LoadVars();
writeLVs.name = theName.text;
writeLVs.address = theAddress.text;
writeLVs.message = theMessage.text;
writeLVs.send("writeData.php?uniqueID=" + getTimer(), writeLVs , "POST");
}


And this is my php code:

<?php
$content = "Name:".$_POST["theName.text"]."<br>Address:".$_POST["theAddress.text"]."<br>Message:".$_POST["theMessage.text"];
$fp = fopen("myMessages.txt","wb");
fwrite($fp,$content);
fclose($fp);
?>


Would anybody be kindly anle to tell me where I'm going wrong?

Thanks.

CyanBlue
10-29-2003, 04:10 PM
Howdy... ;)

Try this...$content = "Name:".$_POST['name']."<br>Address:".$_POST['address']."<br>Message:".$_POST['message'];

labrat
10-29-2003, 04:19 PM
Howdy to you too!

When I tried this, pressed my send button containing the AS above, it produced a blank web page. The "myMessages.txt" file's contents were: Name:<br>Address:<br>Message:.

However, when I was using the original php, it was producing the above bold line in the web page too!

Any other suggestions?

freddycodes
10-29-2003, 05:08 PM
on (release) {
writeLVs = new LoadVars();
writeLVs.name = theName.text;
writeLVs.address = theAddress.text;
writeLVs.message = theMessage.text;
trace (writeLVs.name);
writeLVs.send("writeData.php?uniqueID=" + getTimer(), writeLVs , "POST");
}




If you trace a value before you send it, what do you get? You would need to test this from within flash with Control > Test Movie.

Me thinks you are not referencing the correct path to theName, theAddress, etc...

labrat
10-29-2003, 05:24 PM
Hey freddy. Did the trace. It outputted "undefined"!

CyanBlue
10-29-2003, 08:34 PM
Originally posted by labrat
Hey freddy. Did the trace. It outputted "undefined"! Um... What does that tell you??? :confused:

labrat
10-29-2003, 09:24 PM
CyanBlue

It's late man. Isn't it already defined as text?
writeLVs.name = theName.text;
Or have I really been sat in front of this infernal monitor for way too long today?

freddycodes
10-29-2003, 09:38 PM
It means that theName.text is not a valid object in its current scope. Which means its buried in a movie clip or that your LoadVars object is in a movie clip. So you need to give the full path to the object. Let's say theName was a textfield in a movie clip named "foo" on the main timeline.

You would access it as _root.foo.theName.text

labrat
10-29-2003, 09:48 PM
It's buried inside 2 clips. The file itself gets loaded into an empty mc on level0 of the main movie timeline. So will the code need to go in the main movie timeline or just the swf it currently resides in? Apologies, but it's past midnight here so please be patient.

labrat
10-29-2003, 11:45 PM
Im getting very physically tired now. I'll just leave the zipped fla.

I'm going to bed now. So thanks for your continued help and patience guys!

freddycodes
10-30-2003, 12:14 AM
Your file is corrupt. Did you make it in MX or MX 2004?

You say you load the file into another file, and you use a php script neither of which you added to the zip file.

labrat
10-30-2003, 07:16 AM
I cant see how it could be corrupt! Anyway, it was made in mxpro2004. Sorry the other files weren't included. I did warn that I was tired though.

So apologies for that. Here's the full zip.

freddycodes
10-30-2003, 01:35 PM
My trial of 2004 is out, sorry! Thats why it said it was corrupt. But it probably wasn't. Anyways, I guess I cannot help you. Because I can't open the files.

labrat
10-30-2003, 01:52 PM
Thanks for all the help and sugestions you've offered already.

If anybody else can help with this, I'd greatly appreciate it.