# Embeding a server-side script in flash

**URL:** <https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434>\
**Category:** flash\
**Created:** [December 11, 2002, 7:51pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434 "2002-12-11T19:51:33Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:01pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/21 "2002-12-13T19:01:56Z")

</div>

Im Using Flash MX, is the code of the loadvar correct?

```php

 loadVariablesNum ("scripts/solicitud.php", "0", "Post");

```

and i didnt understand the onLoad thing… 😛

sorry…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:16pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/22 "2002-12-13T19:16:55Z")

</div>

i deleted the files, cookies etc… form internet tools at IE

and restart the PC but its the same…

i did that because i dont know how to use that trick u post here…

oh man, didnt know is very hard to do this.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:18pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/23 "2002-12-13T19:18:58Z")

</div>

Oops, i posted the trick in the wrong thread. :beam: Sorry. :o

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:19pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/24 "2002-12-13T19:19:49Z")

</div>

:o

no prob…

heh

you know what the prob could be.

i phone the host comp. and they support the mail() funct.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:28pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/25 "2002-12-13T19:28:00Z")

</div>

Replace the loadVariables command with this: 🙂

mailHandler = new LoadVars();  
mailHandler.email= Email  
mailHandler.name= FirstName  
mailHandler.comments= ToComments  
mailHandler.sendAndLoad(“scripts/solicitud.php”, mailHandler, “POST”);

Hope it works.

h88 8]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:30pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/26 "2002-12-13T19:30:20Z")

</div>

should i put all the vars that i got in the form like mailHandler.email = Email?  
i got some more…  
i just add them?  
thhat part (mailHandler.email = Email) is for storing the Vars?

thanks… just that and i give it a shoot

mailHandler = new LoadVars();  
mailHandler.email= Email  
mailHandler.name= FirstName  
mailHandler.comments= ToComments  
mailHandler.sendAndLoad(“scripts/solicitud.php”, mailHandler, “POST”);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:34pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/27 "2002-12-13T19:34:34Z")

</div>

Your actually posting 3 variables to a php script, if u checked the php script syko gave you, you will notice that these variables are called: email, name, and comments. Before, You was posting wrong variable names, therefore, the php script won’t validiate these variables into the script. Just try the script and tell me how it goes. :goatee:

h88 8]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 7:47pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/28 "2002-12-13T19:47:18Z")

</div>

didnt werk. :\*(

Inthe Flash

```php

on (release) {
 if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
 gracias = "Email Incorrecto";
 }
 else if (!FirstName.length) {
 gracias = "Escribe un Nombre";
 }
 else if (!ToComments.length) {
 gracias = "Escribe un Mensaje";
 }
 else {

   mailHandler = new LoadVars();
   mailHandler.email= Email
   mailHandler.name= FirstName
   mailHandler.comments= ToComments 
   mailHandler.sendAndLoad("scripts/solicitud.php", mailHandler, "POST");

 gracias = "Enviando su solicitud...";
 }
}

```

in the .PHP

```php

<?
$ToEmail = "chidos@hotmail.com";

$ToName = "thediablo";
$ToSubject = "Solicitud de Hosting/Diseño";

$EmailBody = "Enviado por: $FirstName
Email: $Email
Telefono: $tel

Plan de Hosting: $plan
Diseño: $diseno

Forma de Pago: $pago

Mensaje: $ToComments";

$EmailFooter="
Este mensaje fue enviado por: $name desde <a href="http://www.zonahost.net" target="_blank">ZonaHost</a>";

$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "De: ".$FirstName." <".$Email.">");

Print "gracias=Solicitud Enviada, Gracias.";

?>

```

what could possibly be the error

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:16pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/29 "2002-12-13T20:16:19Z")

</div>

As i said before, your posted flash variables should be matching the php script variables, change “sendAndLoad” to “send” in the script i gave u as well.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:21pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/30 "2002-12-13T20:21:41Z")

</div>

but they are matching no?

```php

$EmailBody = "Enviado por: $FirstName
Email: $Email
Telefono: $tel

Plan de Hosting: $plan
Diseño: $diseno

Forma de Pago: $pago

Mensaje: $ToComments";

```

those are the vars from FLASH Right?

they are correct.

and i change mailHandler.send right? or .Send?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:24pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/31 "2002-12-13T20:24:16Z")

</div>

mailHandler.send

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:25pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/32 "2002-12-13T20:25:57Z")

</div>

BTW, they are not matching.

mailHandler = new LoadVars();  
mailHandler.email/_not matching_/= Email  
mailHandler.name/_not matching_/= FirstName  
mailHandler.comments/_not matching_/= ToComments  
mailHandler.sendAndLoad(“scripts/solicitud.php”, mailHandler, “POST”);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:31pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/33 "2002-12-13T20:31:18Z")

</div>

what u mean not matching?

o man lets see…

humm…

mailHandler.Email = Email  
mailHandler.FirstName = FirstName

like that h88?

or i dont understand…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:32pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/34 "2002-12-13T20:32:55Z")

</div>

Try that:

```php
mailHandler.Email = Email
mailHandler.FirstName = FirstName
mailHandler.ToComments = ToComments

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:35pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/35 "2002-12-13T20:35:59Z")

</div>

ok wait…  
😛

Thanks for ure help man 😃

brb… gonna test it…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:40pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/36 "2002-12-13T20:40:24Z")

</div>

■■■■…

Parse error: parse error in /www/scripts/solicitud.php on line 9

what does that mean

this is line 9

```php

$EmailFooter="
Este mensaje fue enviado por: $name desde <a href="http://www.zonahost.net" target="_blank">ZonaHost</a>";

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:41pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/37 "2002-12-13T20:41:47Z")

</div>

maybe is something with the " "s right?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:48pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/38 "2002-12-13T20:48:20Z")

</div>

ok i removed some ""s and the email is working now but…

in the email the Name of the guy appers Nobody and the variables dosent apper in the message of the email.

only the text not any var.

and also. when i click send the Print command dosent work. it prints the Thanks… in a new window… not in the dymamicbox with var name gracias

```php

<?
$ToEmail = "chidos@hotmail.com";

$ToName = "Cesar Briones";
$ToSubject = "Solicitud de Hosting/Diseño";

$EmailBody = "Enviado por: $FirstName
Email: $Email
Telefono: $tel

Plan de Hosting: $plan
Diseño: $diseno

Forma de Pago: $pago

Mensaje: $ToComments";

$EmailFooter="
Este mensaje fue enviado por: $name desde zonahost.net";

$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "De: ".$FirstName." <".$Email.">");

Print "gracias=Solicitud Enviada, Gracias.";

?>

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:50pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/39 "2002-12-13T20:50:53Z")

</div>

Try this instead:

```php

<?
$ToEmail = "chidos@hotmail.com";

$ToName = "Cesar Briones";
$ToSubject = "Solicitud de Hosting/Diseño";

$EmailBody = "Enviado por: $FirstName
Email: $Email
Telefono: $tel

Plan de Hosting: $plan
Diseño: $diseno

Forma de Pago: $pago

Mensaje: $ToComments";

$EmailFooter="
Este mensaje fue enviado por: $FirstName desde zonahost.net";

$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "De: ".$FirstName." <".$Email.">");

echo "gracias=Solicitud Enviada, Gracias.";

?>

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 13, 2002, 8:56pm UTC](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434/40 "2002-12-13T20:56:13Z")

</div>

im going to cry man :\*(  
is not working the email is sent but with no vars.

and the echo dosent work

[Previous page](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434.md?page=1)

[Next page](https://forum.kirupa.com/t/embeding-a-server-side-script-in-flash/9434.md?page=3)
