Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 03:35
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  PHP, Perl, ASP, JSP, CFM (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis, nothingGrinder)
| | |-+  Musicman - help with php flash checkbox needed
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Musicman - help with php flash checkbox needed  (Read 516 times)
stuart
Server what's that
*
Posts: 11



View Profile Email
« on: 04/25/05, 05:39 »

Hi Musicman

I have had help from you in the past and have seen your sending emails tutorial. I wonder if you could help me with collecting the results of my check boxes in a flash form I have built. I have got all the fields in my form delivering except the checkboxes. When I use trace() the results all get outputted properly so my problem is collecting through my php script. I don't know what to set to get the results.

My checkboxes have instance names of chLaunch, chArt, chFashion, chClub and chBalls. Their labels are Launch Parties, Art Exhibitions, Fashion Shows, Night Clubs and Celebrity Balls.

Here is my actionscript:

.........................

// mail functions

function validateForm(){

if (FirstName.length<=0) {
trace("error")
EmailStatus = "Please enter your first name before sending";
return false;
}
else if (LastName.length<=0) {
trace("error")
EmailStatus = "Please enter your last name before sending";
return false;

}
else if (!Email.length || Email.indexOf ("@") == -1 ||
Email.indexOf (".") ==-1) {
trace ("error");
EmailStatus = "Please enter a valid email address";
return false;
}
else
{
return true;
}

}

function sendMail(){

// create LoadVars object
var l:LoadVars = new LoadVars();
// copy values into it
l.FirstName = FirstName;
l.LastName = LastName;
l.Email = Email;
//radio buttons
l.ageGroup = ageGroup.selectedData;

var checkBoxes:Array = new Array(chLaunch,chBalls,chArt,chFashion,chClub);
for(i=0;i<checkBoxes.length;i++){
l[checkBoxes._name] = checkBoxes.selected;
}

// DEBUGGING: trace what is in the lv now
for(x in l){
trace("prop: " + x + " value: " + l
  • );
}

// when the php script has replied to us...
l.onLoad = function(){
gotoAndStop ("success");
}

// now send data and wait for reply
l.sendAndLoad("angelData.php", l,"POST");

}

//set action for submit button
submit_btn.onRelease = function(){
if(!validateForm()){
gotoAndStop("error");
} else {
sendMail();
}
}

stop();

And here is my php:

<?php

$FirstName = $_POST["FirstName"];
$LastName = $_POST["LastName"];
$Email = $_POST["Email"];
$ageGroup = $_POST["ageGroup"];
$checkBoxes = $_POST["checkBoxes"];

$Body = "Please add to database:
\r\n\n\n Name: $FirstName $LastName
\n\n  Email: $Email\n\n Age Group: $ageGroup
\n\n Interested In the Following Events: $checkBoxes

mail("me@mydomain.com", "Events web form", $Body "From: website@mydomain.com");

echo "response=ok";

?>


I have posted this in other forums but as this is now becoming time-sensitive I hope this is ok with you.
Thanks
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything