probably a stupid mistake
I've got a form that has a huge number of entries, and I'm trying to save a little bit of work. It's ended up being more work than it's worth, I think, but I'm so invested in it that I'd like to know where the heck I screwed up.
the form is located here. I only have this function used on the first radio button in the first option. No matter what is selected or even if anything is selected, the "radio" function below always ouputs the "roff" function.
the form is located here. I only have this function used on the first radio button in the first option. No matter what is selected or even if anything is selected, the "radio" function below always ouputs the "roff" function.
$allset = 1;
function ron($name,$value)
{
print "
";
print " <input ... >";
}
function roff($name,$value)
{
print "
";
print " <input ... >";
}
function radio($vname,$value)
{
global $allset; //$allset determines whether all options have values
global $$vname; //the variable variable $vname is input from a form
if (!isset($vname)) //determine whether $vname is set or not
{
$allset = 0; //if it isn't, change $allset to false
print "<B><font color=red>THIS VALUE IS REQUIRED</B></font><BR>"; //send warning
}
else //if we get lucky
{
if ( $vname == "$value" ) //if $vname equals $value
{
ron($vname,$value); //print a checked radio button and inclue a hidden input field
}
else
{
roff($vname,$value); //print a blank radio button and include a hidden input field
}
}
}
