Page 1 of 1

Sending variables from flash to PHP, calculating..

Posted: Thu Feb 19, 2004 1:16 am
by Steveo31
I'm back :)

Trying out a poll system, nothin fancy, and for no reason, really. But I am having a brain-lapse, and am in need of some assistance. Here's the code in the Flash file:

Code: Select all

poll = new LoadVars();
pollURL = "http://d6c3z021/polltest.php";

//the above is the addy for the apache I have installed.

function submitForm() {
	choice = radioGroup.getData();
	poll.load(pollURL+"?choice="+choice);
}
And on the submit button is submitForm(). I think the problem is in the PHP page. I've never done this type of value processing before, so... enough said :) :

Code: Select all

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?

$choice1;
$choice2;
$choice3;
$choiceCount1=0;
$choiceCount2=0;
$choiceCount3=0;


if($choice1){
	$choiceCount1 += 1;
	echo "$choiceCount1 counts for number 1";
}
elseif($choice2){
	$choiceCount2 += 1;
	echo "$choiceCount2 counts for number 2.";
}
elseif($choice3){
		$choiceCount3 += 1;
		echo "$choiceCount3 counts for number 3.";
}
else{
	echo "No values encountered.";
}
?>
</body>
</html>
I'm tryin to send the value of the radio button with a "http://blahblah/poll.php?choice=2" type code, so the PHP can see a choice variable has been attached to it (or sumthing...not sure yet) and then add to the variables that have been set up.

Any ideas? :D

Steve

Posted: Thu Feb 19, 2004 2:33 pm
by Dr Evil
What is your idea behind this:

Code: Select all

...

<?php
$choice1; 
$choice2; 
$choice3; 
...
?>
?

Posted: Thu Feb 19, 2004 4:28 pm
by Steveo31
Just declaring without assigning.