PHP form, checkboxes, and stuff

ok, i hate botherin you guys again, but im completely stuck.

ill make this totally simple,

i am using your code, cyan, on the submit button:

[AS]
on (press) {
if (!name.length) {
status = “Please enter your name”;
} else if (!firm.length) {
status = “Please enter your law firm”;
} else if (!phone.length) {
status = “Please enter your phone number”;
} else if (!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
status = “Please enter a valid E-mail address”;
} else {
//loadVariablesNum(“form.php”, “0”, “POST”);
sendLVs = new LoadVars();
sendLVs.name = this.name;
sendLVs.firm = this.firm;
sendLVs.phone = this.phone;
sendLVs.email = this.email;
sendLVs.type = this.type;
sendLVs.anim = this.anim.getValue();
sendLVs.vid = this.vid.getValue();
sendLVs.vid2 = this.vid2.getValue();
sendLVs.web = this.web.getValue();
status = “Sending…” + name + " : " + firm + " : " + phone + " : " + email + " : " + type + " : " + anim.getValue() + " : " + vid.getValue() + " : " + vid2.getValue + " : " + web.getValue();
sendLVs.onLoad = function ()
{
status = sendLVs.status;
this.name = “”;
this.firm = “”;
this.phone = “”;
this.email = “”;
this.type = “”;
this.anim.setValue(false);
this.vid.setValue(false);
this.vid2.setValue(false);
this.web.setValue(false);
}
sendLVs.sendAndLoad(“form.php”, sendLVs, “POST”);

}

 }

[/AS]

that’s it. if i JUST do that, it does everything right, exCEPT that it prints out true and false in the email instead of “animation” or nothing like i would like it to. now don’t get me wrong, i know that i have to add something somewhere in order to do that, but i dont know what and where. :hangover:
thanks

I was thinking about you this morning, and I was hoping you had resolved your issue. I am glad others were here to help you. That is what this board is all about.

hehehe. simultaneous post, eh?

well… you can do two things.

Tell Flash that if checkbox1 is true… variablex=animation
and send variablex to php for processing.

or, convert the value in PHP. Me? I think I would do it in Flash, but I dont know why. hehe

Yep! Twice.

sounds good, that’s what i’ve been trying to do since this morning when i put in cyan’s code and it worked. but i guess i’ve been doing it wrong, because everything i try either makes it print out weird instance names in the email, or all of the varibles. (like if i just checked animation, all four options would be displayed)
could you walk me through it?

if checked, you want the value returned to be “animation”? (in first box)

if not checked, what do you want it to say?

well… here is the crude response.



setvalue=function(){
	
	if(cb1.getvalue()==true){
		varAnimation="animation";
	}else{
		varAnimation="no animation";
		}
	if(cb2.getvalue()==true){
		varVid1="vid1";
	}else{
		varVid1="no vid1";
	}
}


The deal is:

Instead of sending the following to php…
sendLVs.anim = this.anim.getValue();
sendLVs.vid = this.vid.getValue();
sendLVs.vid2 = this.vid2.getValue();
sendLVs.web = this.web.getValue();

You could send the actual values you want inside a variable

                 sendLVs.anim = varAnimation;
                 sendLVs.vid = varVid1;
                 sendLVs.vid2 = varVid2;
                 sendLVs.web = varWeb;

one last thing… you can call that setvalue function wherever you want, like as a change handler for each check box, as a routine to run before submit, etc…

hope that helps.

hehe, thanks. sorry, i was in la- la land. i want it to say nothing. so i would assume i would just put varAnimation="";
let me try that out. :slight_smile:

ok, update. everything is ok now. i couldn’t get it to work in flash, even though i did what you said mr. montoya, so i just did it in PHP instead, by changing the variable to a string. i feel bad that i couldn’t do it the flash way, but hey, it’s all working now, so im relaxed again. lol. thanks for all your help. :slight_smile: i learned a lot
from this experience. ah, off to some well needed sleepytime.