[quoted text, click to view] Coder III wrote:
> On my submit button I have the code:
> on (release) {
> getURL("http://localhost/sendmail.php", "_blank", "GET");
> }
>
> What must I look for in order for the variable to be passed properly.
> I have a feeling that it's gotta do with Time Line or something like that.
I have a feeling that you're grasping at straws to find that "magic
solution". Using getURL is not the best way to go about things. The
problem is that you've found something on the web without realizing that
getURL is the kludge that had to be used in the days of Flash 5.
Concentrate on working with LoadVars, and you'll get things right. Also
get out of the habit of putting scripts on buttons. It creates
difficulties for finding other variables, and getting the right path for
everything.
Since you've downloaded my sample chapter, the answer is on pages 73-77.
Give your button an instance name, and put the ActionScript on the main
timeline. What you need is something like this:
submit_btn.onRelease = function() {
send_lv.fname = mytext_input.text;
send_lv.sendAndLoad("http://localhost/sendmail.php?ck=" + new
Date().getTime(), reply_lv);
};
send_lv = new LoadVars();
reply_lv = new LoadVars();
reply_lv.onLoad = function() {
if (this.output != undefined) {
result_txt.text = this.output;
}
};
In the PHP script
<?php
echo 'output='.urlencode('The variable passed is '.$_POST['fname']);
?>
--
David Powers
Author, "Foundation PHP 5 for Flash" (friends of ED)
Co-author "PHP Web Development with DW MX 2004" (Apress)