# 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:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Illuminae](https://avatars.discourse-cdn.com/v4/letter/i/b5ac83/32.png) [@Illuminae](https://forum.kirupa.com/u/Illuminae)\
**Post date:** [April 6, 2003, 9:06am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/1 "2003-04-06T09:06:50Z")

</div>

Hello. I am havign a few issues with doing a flash form using PHP. First of all, the way the form is set up, I have a few input text feilds, a few checkbox components, and clear and submit buttons. I am having several problems.

First of all, when I clear the checkboxes, it visually clears them, but it doesn’t clear the data, because if I fill out the form and check the boxes, and then clear it, and then send it with only one or no boxes checked, I still get the data in the PHP email. Here is the AS i am using:

(Just a quick update, apparently, also, if i check the box and then uncheck it again, it also registers as having been checked anyways)

on the checkboxes:

on (press){  
\_global.web = this.getValue();  
if (\_global.web = O) {  
\_global.web = “Website”;  
} else {  
\_global.web = null;  
}  
}

on the clear button:

web.setValue(0);

on the submit button:

web = \_global.web  
loadVariablesNum(“form.php”, “0”, “POST”);

Also, my second problem is I am trying to send a message back to flash from the PHP into a dynamic text box in the form saying Thanks, blah blah. and that isn’t working either. the entire form is contained within a MC called ContactMC. the textbox’s variable is “status”. This is the line I have in the PHP after the mail bit:

Print “\_root.ContactMC.status=Your form has been sucessfully sent. Thank you!”;

If anyone coudl help me with these issues I would be soooooooooo much less stressed…lol.  
If you need me to post a fla, let me knwo and I will.  
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 6, 2003, 2:40pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/2 "2003-04-06T14:40:11Z")

</div>

would you post your fla? With problems like these, we sometimes have to recreate the whole thing. Then again, someone might take a look and say “there’s the problem”. In either case, it helps to get a better look.

---

<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 6, 2003, 8:09pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/3 "2003-04-06T20:09:06Z")

</div>

sure, ill post the fla and the php. 🙂

---

<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 6, 2003, 8:10pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/4 "2003-04-06T20:10:36Z")

</div>

here is the php

woops!!! i jsut noticed, int he PHP, the one i uploaded is a little different from the one i was using…

in the last line, it should read

Print “\_root.contentContactMC.status=Your form has been sucessfully sent. Thank you!”;

sorry!

---

<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 6, 2003, 8:13pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/5 "2003-04-06T20:13:58Z")

</div>

p.s. Inigo is like my ALL TIME favorite dude to quote…  
:beam:

---

<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 6, 2003, 10:15pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/6 "2003-04-06T22:15:39Z")

</div>

\>=]

---

<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 6, 2003, 10:41pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/7 "2003-04-06T22:41:47Z")

</div>

anyone? i hate to be a pain in the arse… but if i dont have this by tomorrow my butt is grass. i’ve been puttering around with it and still haven’t figured it out. grr.

---

<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 7, 2003, 12:50am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/8 "2003-04-07T00:50:27Z")

</div>

Hey, golgi… I’ll try to take a look, but Im not sure if I’ll have for you before you need it. Check back late (really late). Can’t promise anything though, I have some deadlines myself.

😉

---

<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 7, 2003, 1:22am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/9 "2003-04-07T01:22:46Z")

</div>

the problem is probably that you have global variables turned off on your server, a simple fix is this:

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=15399&highlight=%24POST](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=15399&highlight=%24POST)

---

<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 7, 2003, 1:34am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/10 "2003-04-07T01:34:24Z")

</div>

wait a sec, jubba, you mean like put this  
$Subject\_=\_$\_POST[‘Subject’];

$Body\_=\_$\_POST[‘Body’];

$MailFrom\_=\_$\_POST[‘MailFrom’];

at the top of the PHP?

---

<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 7, 2003, 1:36am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/11 "2003-04-07T01:36:45Z")

</div>

yeha you would put that at the top of the php file for each variable in your flash movie. I didn’t look at your fla but say you had the variables: “junk” “munk” & “punk”

you would do this in the php file:

```php

$junk = $_POST['junk'];
$munk = $_POST['munk'];
$punk = $_POST['punk'];

// The rest of your code would go here....

```

---

<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 7, 2003, 1:43am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/12 "2003-04-07T01:43:34Z")

</div>

hrm, i jsut tried it and the form didnt work at all then. oen ques, and this si gonna sound really dumb, but what issue is this trying to fix? the checkboxes?

---

<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 7, 2003, 1:44am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/13 "2003-04-07T01:44:35Z")

</div>

I see single equal sign in your if statement and no quotes around O… if you didn’t fix it yet, you will need to fix it though…  
if (\_global.web = O) {  
to  
if (\_global.web == “O”) {

---

<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 7, 2003, 1:59am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/14 "2003-04-07T01:59:59Z")

</div>

ok, CyanBlue, that almost worked. i changed the code to  
on (press){  
\_global.web = this.getValue();  
if (\_global.web == “O”) {  
\_global.web = “Website”;  
} else {  
\_global.web = null;  
}  
}

but then i kept getting null printed in the email for everything. so then, i switched it around to

on (press){  
\_global.web = this.getValue();  
if (\_global.web == “O”) {  
\_global.web = null;  
} else {  
\_global.web = “Website”;  
}  
}

then it was back to the original problem again. did i miss something?

---

<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 7, 2003, 6:18am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/15 "2003-04-07T06:18:45Z")

</div>

ok, here i am again, 2 am, still working on this. but the good news is i have resolved almost all of the issues.  
first off, i gave up on getting the “Thank you” printed from the PHP back into flash, instead I just made it go to a new frame with a thank you on it. Also, as for the clicking the checkboxes and getting rid of the values, this is what I did. Now you can check the checkbox, and then uncheck it, and it clears it for real  
on the checkbox:

on (press){  
\_global.web == this.getValue();  
if (\_global.web == “O”) {  
\_global.web = null;  
} else if (\_global.web == “1”) {  
\_global.web = “Website”;  
}  
}

Also, I have managed to get it so that if you click on the clear button, it also clears it. this is what I have on the clear button:

\_global.web = “”;  
web.setValue(0);

so that’s pretty much it. i’m sure my code is sloppy, and there must be a better way, but it works for now, so it’s good for me! i appreciate all your help guys. 🙂 and if anyone figures out how to make the PHP make text back into flash, i would love to see your solution.

thanks thanks thanks  
:beam:

---

<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 7, 2003, 6:24am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/16 "2003-04-07T06:24:55Z")

</div>

\>=]

---

<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 7, 2003, 6:50am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/17 "2003-04-07T06:50:01Z")

</div>

your problem might also come from using web both as \_global.web and just web, the thing is that for Flash, once you’ve used \_global.web once, it considers “web” as a global var, it’s then the same to use either, and I guess you were trying to use web for another purpose than \_global.web…? clear?  
always best when using globals to put a distinctive letter before, like gWeb…

---

<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 7, 2003, 6:53am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/18 "2003-04-07T06:53:28Z")

</div>

Ahhh, good point. Thank you eyez 🙂

---

<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 7, 2003, 6:55am UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/19 "2003-04-07T06:55:00Z")

</div>

I’m glad you got it working…

I have tried your code a while ago and used LoadVars() object instead of loadVariablesNum() function… and I do get the word from PHP script…

Else block of the button…

```auto
	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("http://localhost/golbi/form.php", sendLVs, "POST");
	}

```

PHP code…

```php
<?
	$name = $_POST['name'];
	$firm = $_POST['firm'];
	$phone = $_POST['phone'];
	$email = $_POST['email'];
	$type = $_POST['type'];
	$anim = $_POST['anim'];
	$vid = $_POST['vid'];
	$vid2 = $_POST['vid2'];
	$web = $_POST['web'];
	
	$to = "wooliesock@yahoo.com";
	$subject = "CRT Form";
	$msg = "Sent by: $name

";
	$msg .= "Law firm: $firm

";
	$msg .= "Phone number: $phone

"; 
	$msg .= "Email: $email

"; 
	$msg .= "Type of Trial: $type

";  
	$msg .= "Projects Interested in:

";
	$msg .= "$anim

"; 
	$msg .= "$vid

"; 
	$msg .= "$vid2

"; 
	$msg .= "$web

"; 
	mail($to, $subject, $msg, "From: $name
Reply-To: $email
");
	print "status=Your form has been sucessfully sent. Thank you!";
?>

```

Notice that I got rid of \_root part in the PHP script…

Can you post your file one more time??? I can’t get this radio buttons working… ☹

Well… Good night… Gotta get some sleep… 😉

---

<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 7, 2003, 10:31pm UTC](https://forum.kirupa.com/t/php-form-checkboxes-and-stuff/17517/20 "2003-04-07T22:31:50Z")

</div>

i must be the dumbest person ever. oi. here’s the thing. i THOUGHT i got it working, but i guess since it was like 4 am, i overlooked soemthing big. hehe. yeha, when you pressed clear, or unchecked the checkbox, nothing showed up in the email, like i wanted it to. but apparently, when you CHECK the checkbox, nothing showed up in it either! so i have decided to start from square 1 again. i tried doing it a different method by following a tut on macromedia and making a function for when the box is pressed instead of doing on (press), but that didnt work. then i tried your code, cyanblue, and that didn’t work for me either! which means, that it HAS to be something i am fudging up, because obviously it worked for you…

ok, editing… new progress. i got the darn thing to work. everything works. except for when it goes to the email, it says “true” or “false” instead of animation or nothing, but i’m pretty sure i can fix that. if i get stuck i’ll post again… until then, wish me luck (-:

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