PDA

View Full Version : Contact Form w/ Components Sent to PHP



megamichan
April 13th, 2007, 04:32 PM
Hi all,

I nearly have my contact form complete, but I'm still having problems sending the labels from my comboboxes to PHP correctly.

I'm not even sure which code to look at, but I finally got the labels to send to my email through PHP, but it only sends the first label (IE: "Please Select...")

Here's the code on the first frame of the conact form:


comboservice = new Object();
comboservice.change = function(eventObj)
{
var eventSource = eventObj.target;

var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
}

boxservice.addEventListener ("change", comboservice);



_root.flash.addListener();

_root.php.addListener();

_root.video_music.addListener();

_root.art.addListener();


combobudget = new Object();
combobudget.change = function(eventObj)
{
var eventSource = eventObj.target;

var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
}

boxbudget.addEventListener ("change", combobudget);

// array of the checkboxes
var cb = [_root.flash, _root.php, _root.video_music, _root.art];

// add listeners
for (var i = 0; i < cb.length; i++)
{
cb[i].addEventListener("click", this);
}

// handle click
function click(o:Object)
{
updateTextfield();
}

function updateTextfield()
{
var str = "";
for (var i = 0; i < cb.length; i++)
{
if (cb[i].selected)
{
if (str == "") str = cb[i].label;
else str += " "+cb[i].label;
}
}

// now set the textfield
_root.five.text = str;
}

var boxservice = _root.boxservice.selectedItem.label;
var boxbudget = _root.boxbudget.selectedItem.label;

And here's what's on my Submit button:


on (release) {
if (_root.name eq undefined or _root.description eq undefined or _root.email eq undefined or _root.pages eq undefined) {
_root.statusArea.text = "Please fill all text fields";
}
else if (_root.email.indexOf("@")<0 or _root.email.indexOf(".")<0) {
_root.statusArea.text = "Please use a valid email address";
}
else {
var boxservice = _root.boxservice.selectedItem.label;
var boxbudget = _root.boxbudget.selectedItem.label;
_root.loadVariables("fts_email.php", "POST");
_root.nextFrame();
}
}


Any suggestions on what to do/try are greatly appreciated!

webreake
April 13th, 2007, 09:45 PM
when you use

_root.loadVariables("fts_email.php", "POST");
where do you include the vars to send ??
i think you need this:

_root.loadVariables("fts_email.php?combo1val="+boxbudget+"&combo2val="+boxbudget , "POST");

megamichan
April 13th, 2007, 10:14 PM
I don't have the vars to send because that's what I need help with. I'm not sure how any variables are being sent, but somehow my PHP script is picking up on the vars established in the script. I think it's because I'm loading the vars from _root, and I placed the vars on the frame of the contact form in addition to the submit button.

A thread that looked promising was:
http://www.kirupa.com/forum/showthread.php?t=240588&highlight=form+components+php
but I didn't know where, and how, to add the statement into the loadVariables.

I tried the code you provided, but it's doing the same thing (sending the "Please Select" label through email). I'm going to try some other tests to see what happens.

megamichan
April 14th, 2007, 09:26 PM
I'm still not having any luck. Does anyone know if this is an issue with my listener?