View Full Version : Using mail.php wih multiple variables

08-08-2001, 02:36 PM
Hi all!

I have modified the mail.php to include multiple variables from flash. However, I cannot get it to work properly. Can anyone tell me what I'm doin' wrong here?

The original mail.php file:

mail("[email protected]", "Påmelding til" $KursID, $message, "From: AOF Kursbestilling\nReply-To: $from\nX-Mailer: PHP/" . phpversion());

The modified file (the message-variable is replaved by multiple variables from flash):

<?php mail("[email protected]", "Påmelding til" $KursID,
"Påmelding til kurs hos AOF"\n\n
"Fornavn" $fornavn\n
"Etternavn" $etternavn\n
"Fødselsdato" $fdato\n
"Adresse" $adresse\n
"Postnummer" $postnr\n
"Poststed" $poststed\n
"Telefon" $telefon\n
"Mobil" $mobil\n
"Epost" $email\n\n
"Kursnummer" $KursID\n
"Kurs" $kurs_beskrivelse\n
"Sted" $kurs_sted\n
"Start dato" $kurs_startdato\n
"Start kloke" $kurs_startklokke\n
"Kursavgift" $kurs_avgift\n
, "From: AOF Kursbestilling\nReply-To: $email\nX-Mailer: PHP/" . phpversion());

You see the point? I want to include the variables from my form in flash to a dynamic email-reply.

Thanx in advance! :)


08-08-2001, 07:33 PM
The PHP string conatenation operator is the dot ( . ). You need to concatenate your strings, not just put them all next to each other:
$string1 = "my bear";
$string2 = "roar!";
$both = $string1 . " says " . $string2;
int he example above, $both will have the value 'my bear says roar!'. get it?

08-08-2001, 07:42 PM
Oh! I totally forgot! :) Thanx!!

On the other hand, I guess I can send all the variables from flash, putting them together..

If message is the variablename thats beeing used by the php-script, then I can do the following in flash:

message = "Firstname: " add firstname add "\n" add "Lastname: " add lastname;

Do I have to consider something else if I do it this way?
I guess this is maybe the best solution if I want to use the same php-script for all forms..?


08-08-2001, 07:49 PM
I would do it in Flash personally but remember there is a limit (it's big but I forget how big) on how much data you can send via GET... so don't have 100 pages strings sending from Flash b/c it will die :) also remember that if you build the string in PHP the newline character is "\n" with quotes, which you left out above.

08-08-2001, 08:46 PM

Now I've been fooling around with this for some time, and it seems like I can't seem to get the variables added together in flash before the form is sent to PHP...

Oh well.. It's 03:40 local time now, so I'll continue tomorrow. Thanx for all help.

When I get all this to work I can publish it somewhere so you guys won't have to do the same work and be draggin' out your hair in despair if it doesnt work the way it should.


08-09-2001, 07:00 PM
The concantation operator in Flash is '+', not '.' like in PHP. You probably know that, but just in case that is the problem there.

Also the realistic maximum length of a URL (and hence a limiter for the GET method which puts all the data in a URL) is just 256 characters. Standard installations of Apache will handle much larger URLs, but you can't be sure it will work everywhere.


08-09-2001, 07:21 PM
Thanx for all help here.

This bit works totally fine now.
I did'nt know about the limit of 256 chars in GET..
Luckily I will only use this with my own apache server ;)