# PHP form, checkboxes, and stuff

**URL:** <https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517>\
**Category:** flash\
**Created:** [April 6, 2003, 9:06am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517 "2003-04-06T09:06:50Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 1:53am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/21 "2003-04-08T01:53:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 1:53am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/22 "2003-04-08T01:53:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 1:54am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/23 "2003-04-08T01:54:28Z")

</div>

hehehe. simultaneous post, eh?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 1:55am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/24 "2003-04-08T01:55:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 1:56am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/25 "2003-04-08T01:56:20Z")

</div>

Yep! Twice.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 1:59am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/26 "2003-04-08T01:59:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 2:11am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/27 "2003-04-08T02:11:22Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 2:26am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/28 "2003-04-08T02:26:46Z")

</div>

well… here is the crude response.

```auto

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 2:29am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/29 "2003-04-08T02:29:29Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 6:10am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/30 "2003-04-08T06:10:23Z")

</div>

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. 🙂 i learned a lot  
from this experience. ah, off to some well needed sleepytime.

[Previous page](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517.md?page=1)
