473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Flash/PHP form with text fields and checkboxes

where to start! - i'm new to this!

ok. i am trying to create a form in flash that will post results to a nominated email address. the form contains some text fields and some checkboxes. Thus far i have got the checkboxes working, but my text field entries come thru blank. Also i am trying to make some text fields mandatory. at the moment if i hit submit it sends it anyway!

Any help would be greatly appreciated.
May 22 '07 #1
3 5572
Motoma
3,237 Expert 2GB
where to start! - i'm new to this!

ok. i am trying to create a form in flash that will post results to a nominated email address. the form contains some text fields and some checkboxes. Thus far i have got the checkboxes working, but my text field entries come thru blank. Also i am trying to make some text fields mandatory. at the moment if i hit submit it sends it anyway!

Any help would be greatly appreciated.
It would be easier if you could post your code for both the actionscript and the mailer.
May 22 '07 #2
thanks for replying

here is my actionscript.



stop();

_root.clear_butt.onPress = function() {
firstname="";
phone="";
mobile="";
email="";
address="";
time="";
}


var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();


_root.sender.onRelease = function() {
if (!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
status_txt.text = "Invalid Email.";
} else if (!firstname.length) {
status_txt.text = "Missing Name";
} else if (!address.length) {
status_txt.text = "Missing Address";
} else if (!phone.length) {
status_txt.text = "Missing Phone";
} else {
senderLoad.email = email.text;
senderLoad.address = address.text;
senderLoad.phone = phone.text;
senderLoad.firstname = firstname.text;
}
if (_root.check_email.selected == true) {
senderLoad.check_email = "Yes";
} else {
senderLoad.check_email = "No";
}
if (_root.check_mail.selected == true) {
senderLoad.check_mail = "Yes";
} else {
senderLoad.check_mail = "No";
}
if (_root.check_phone.selected == true) {
senderLoad.check_phone = "Yes";
} else {
senderLoad.check_phone = "No";
}
if (_root.check_newspaper.selected == true) {
senderLoad.check_newspaper = "Yes";
} else {
senderLoad.check_newspaper = "No";
}
if (_root.check_direct_mail.selected == true) {
senderLoad.check_direct_mail = "Yes";
} else {
senderLoad.check_direct_mail = "No";
}
if (_root.check_agent.selected == true) {
senderLoad.check_agent = "Yes";
} else {
senderLoad.check_agent = "No";
}
if (_root.check_referral.selected == true) {
senderLoad.check_referral = "Yes";
} else {
senderLoad.check_referral = "No";
}
if (_root.check_visit.selected == true) {
senderLoad.check_visit = "Yes";
} else {
senderLoad.check_visit = "No";
}
if (_root.check_info_yes.selected == true) {
senderLoad.check_info_yes = "Yes";
} else {
senderLoad.check_info_yes = "No";
}
senderLoad.sendAndLoad("sendit.php", receiveLoad, "POST");
}

receiveLoad.onLoad = function() {
if (this.sentOk) {
_root.gotoAndStop("thank");
} else {
_root.gotoAndStop("again");
}
}




and here is my php bit


<?PHP

$to = "me@myemail.com.au";


// These are your form's fields.

$firstname = $_POST['firstname'];
$phone = $_POST['phone'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$address = $_POST['address'];
$time = $_POST['time'];
$check_email = $_POST['check_email'];
$check_mail = $_POST['check_mail'];
$check_phone = $_POST['check_phone'];
$check_newspaper = $_POST['check_newspaper'];
$check_direct_mail = $_POST['check_direct_mail'];
$check_agent = $_POST['check_agent'];
$check_referral = $_POST['check_referral'];
$check_visit = $_POST['check_visit'];
$check_info_yes = $_POST['check_info_yes'];

// This is your formatted message.

$subject = "Cilento Penthouse Online Enquiry\n";
$message .= "----- Cilento Penthouse Online Enquiry -----\n\n";
$message .= "Name: $firstname\n";
$message .= "Phone: $phone\n";
$message .= "Mobile: $mobile\n";
$message .= "Email: $email\n";
$message .= "Address: $address\n\n";
$message .= "----- How would you like to be contacted -----\n\n";
$message .= "Email: $check_email\n";
$message .= "Mail: $check_mail\n";
$message .= "Phone: $check_phone\n\n";
$message .= "----- If phone what time -----\n\n";
$message .= "Time: $time\n\n";
$message .= "----- How did you hear about the Cilento Penthouse -----\n\n";
$message .= "Newspaper: $check_newspaper\n";
$message .= "Direct Mail: $check_direct_mail\n";
$message .= "Agent: $check_agent\n";
$message .= "Referral: $check_referral\n";
$message .= "Visit: $check_visit\n\n";
$message .= "----- Please send me further details on the Cilento Penthouse -----\n\n";
$message .= "More information: $check_info_yes\n";


$mailheaders = "From: $firstname <email>\n";

$sentOk = mail($to,$subject,$message,$mailheaders);


echo "sentOk=" . $sentOk;

?>
May 22 '07 #3
Motoma
3,237 Expert 2GB
Have you tried unit testing? Set up a PHP script to read the data the flash is sending. Write a PHP script to POST data to the PHP Mailer.
May 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there...
7
by: pizzy | last post by:
PROBLEM: I CAN'T GET THE LAST RESUTS TO WORK CORRECTLY. I WOULD PROVIDE THE CODE (AND WILL IF REQUESTED). BUT IN MY OWN WORDS I AM TRYING TO HAVE THE FIRST FORM DYNAMICALLY CREATE INPUT BOXES...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
0
by: Benjamin Bittner | last post by:
Hallo NG, ive searched a lot in some google groups, and found many threads, but nothing that helped me. Here is the scenario: I have an aspx page which loads a user control in page.onInit like...
0
by: spyyder | last post by:
ANY HELP would be really really appreciated dudes.. Ok.... heres the snag...my flash mail form has these fields, TextInputs: 'name' , 'email', 'budget', TextAreas: 'Message' ComboBoxes:...
3
by: Robert McEuen | last post by:
Using A2K3, Windows XP I'm handling a many-to-many relationship with a linking table structure as follows (irrelevant fields omitted): tblIssue PK_IssueID (autonumber, primary key) IssueName...
1
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have...
1
by: runway27 | last post by:
i have 3 pages page1.php page2.php and page3.php in page1.php user fills a registration form in page2.php the user can review what they have entered and make any changes and page3.php...
7
by: jcnone | last post by:
Does anyone know how to populate form fields on a html web page (client side) with data from an Excel file (CSV) or text file. I am currently having to input data to many text fields manually. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.