Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Variables from Flash5 to an URL 1

Status
Not open for further replies.

Wyrm2012

Programmer
Jul 3, 2001
38
GB
I'm sure there is a really easy way to do this but I can't work it out.
I am trying to recreate an HTML form in Flash 5 but what is the best way to send the variables?

The user must fill in several Text Input boxes and then the content of these must be sent along with the values of several 'hidden' Input fields. Also the variables must be URL encoded on submission.

I tried using the getURL command but I don't think it worked.

Incase this makes it clearer, here is the Form Action I wish to recreate and the variables that must be sent:

form action=" enctype="multipart/form-data" method="get" target="frame2"

input name="Type" type="hidden" value="text"
input name="Text" type="hidden" value="text"
input name="UserName" type="hidden" value="whatever"
input name="Passwd" type="hidden" value="whatever"
input name="Msg" type="text" value=" "
input name="Destination" type="text" value=" "

The first 4 variables always have the same value but the user determines the last two.

Should I use getURL, loadVariables, FSCommand or loadMovie?

Thanks,
 
I think all you need to do is use getURL and select get as your send method; I'm pretty sure that Flash sends all of the variables on the timeline to the html page; so where you have hidden fields in your form, you just need to set a variable to them in Flash and it will be sent to your page.

I can't remember how you access form variables in html sent with post; I don't think you need the form name though do you? In which case you can use the POST method if you don't want all your variables on display for the world to see in the browser address line.

Hope this is useful anyway, and hope it makes some sort of sense too!

X-)

PetitPal.
 
I can help with part of this....

to set the hidden fields...create a new layer on the same timeline as your form is on. Right click on the same frame number as your form is on and select actions.... select set variable and make your variable equal to what it needs to be.

For instance you have a hidden field called &quot;recipient&quot; that needs to be equal to &quot;you@youremailaddress&quot; you would do a set variable action... type &quot;recipient&quot; in the top input box and <your email address> in the bottom one. leave the expression checkbox unchecked.

you would do a new one of these on the same frame for each hidden field you want to create.

for your input fields...simply name the text field in the text panel. make sure it is set to input text and not dynamic text.

This may be as clear as mud..... let me know if you need more help and I will try again...there are other guys in the forum who are better at explaining than I am. Ya' Gotta Love It!
sleepyangelsBW.jpg
 
and yes...you do use getURL with the address to you cgi/perl/php script in the top box. Ya' Gotta Love It!
sleepyangelsBW.jpg
 
Thanks guys,

I've got all of the variables set up but what is the syntax for sending them?

If this is the code then where do I attach the variables?

getURL (&quot;URL&quot;, &quot;target&quot;, &quot;method&quot;)
 
You don't actually specify the variables; this is what I meant earlier by Flash sends all of them; it literally sends all of the variables from the movie to your url.

Which is nice.

X-)

PetitPal
 
Thanks everyone, I've got it working now. I don't suppose anyone can help with the next phase? See the other thread I started to do with this.

cheers Live forever or die trying.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top