# Passing variable from flash to javascript then to cgi

**URL:** <https://forum.kirupa.com/t/passing-variable-from-flash-to-javascript-then-to-cgi/157047>\
**Category:** web dev\
**Created:** [July 29, 2005, 4:34pm UTC](https://forum.kirupa.com/t/passing-variable-from-flash-to-javascript-then-to-cgi/157047 "2005-07-29T16:34:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GreenBerry](https://avatars.discourse-cdn.com/v4/letter/g/e47c2d/32.png) [@GreenBerry](https://forum.kirupa.com/u/GreenBerry)\
**Post date:** [July 29, 2005, 4:34pm UTC](https://forum.kirupa.com/t/passing-variable-from-flash-to-javascript-then-to-cgi/157047/1 "2005-07-29T16:34:53Z")

</div>

Hi,

I can’t figure this out, hope someone can help me out.  
I have a email-form in flash (mx 2004).  
I have a website at xs4all, a basic account and this provider does not allow the use of php with this account.

But they do offer the use of a cgi-script (mail-a-form,they call it,you can’t edit it)  
This is all perfectly working if you use the HTML-code they provide, most important that you use FORM METHOD=“post”, I tried to send the needed variable(s) directly from within flash but I got an error back the it wasn’t using the FORM METHOD=“post”. thingy

So i thought I just pass the email variable from flash \<with getUrl\> to a javascript function and from there place them in this form and submit it with the same function…;

This is the code for the form in my index.html in the body:

```auto
 
<FORM METHOD="post" ACTION="/cgi-bin/mail-a-form" NAME="emailForm">
<INPUT TYPE="hidden" NAME="missing" VALUE="[http://www.xs4all.nl/~accountname/](http://www.xs4all.nl/~accountname/)">
<INPUT TYPE="hidden" NAME="from" value="">
<INPUT TYPE="hidden" NAME="subject" VALUE="email sent after website visit">
<INPUT TYPE="hidden" NAME="to" VALUE="[email="myname@xs4all.nl"]myname@xs4all.nl[/email]">
<INPUT TYPE="hidden" NAME="required" VALUE="from">
</FORM>

```

[size=1]  
[/size]

This is the code i created:

```auto
 <SCRIPT LANGUAGE="javascript"> 
function subMitEmail(email,emailName){
 
var email = email
var name = emailName
document.emailForm.from.value = name
document.emailForm.required.value = email
document.emailForm.submit(); 
};
</script>

```

in actionscript i use:

```auto
   
getURL("javascript:subMitEmail(" + email + "," + emailName +")", "_SELF","POST");
 

```

[size=2]In the javascript function I tried to use document.emailForm.from.write(email) but with no succes either. I think i am close to a solution but don’t know what to do anymore, any suggestions???[/size]

Thanks in advance,

Berry.
