ok. have you tested the php without flash - in a browser with a form or
hardcoded values? writing a file... does the directory have write access?
is the variable defined? test if... wait i see a possible problem. scope
issue.
myVars.onLoad = function() {
if (this.verify == "success") {
email_txt.text = "Data Saved";
} else {
email_txt.text = "Failed Save";
}
};
inside the onLoad function you can use this instead of myVars... not sure
its thats you problem could be just good pratice.
another thing you can do is check the if the variable verify is defined (
this.verify == undefined) . i think that could be the main issue. check you
php! remove the & as verify is your first variable and probably remove the
last as you don't need it unless you are declaring another variable.
<?php
$userEmail = $_POST['userEmail'];
$add = $userEmail;
$open = fopen('emails.txt', 'a');
$write = fwrite($open, $add);
if($write) {
echo "verify=success";
} else {
echo "verify=fail";
}
?>
give it a go. sometimes it takes another person
to look at your code. peer review is great.
On 21/03/06, stone larsen <[EMAIL PROTECTED]> wrote:
>
> Can someone please lend a hand, might be staring to
> long at the screen. This is suppose to write to a .txt
> file, all I get is "failed".
>
> ok, this is the AS.
>
> var serverLang:String = "php";
> var myVars:LoadVars = new LoadVars();
> myVars.onLoad = function() {
> if (myVars.verify == "success") {
> email_txt.text = "Data Saved";
> } else {
> email_txt.text = "Failed Save";
> }
> };
> submit_btn.onRelease = function() {
> if (!email_txt.length || email_txt.indexOf("@") == -1
> || email_txt.indexOf(".") == -1) {
> email_txt.text = "Invalid Email.";
> } else {
> myVars.userEmail = email_txt.text;
> myVars.sendAndLoad("writeToFile."+serverLang,
> myVars, "POST");
> }
> };
>
> php for the app:
>
> <?php
> $userEmail = $_POST['userEmail'];
> $add = $userEmail;
> $open = fopen('emails.txt', 'a');
> $write = fwrite($open, $add);
>
> if($write) {
> echo "&verify=success&";
> } else {
> echo "&verify=fail&";
> }
> ?>
>
> PLEASE, some assistance.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
--
Go Dennis!
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com