hi,
im making a website for my final year project, and im having some trouble. im making a voting site that uses the single transferable vote method. im new to php as well.
basically, im having trouble handling radio buttons made in another script. the problem i have is that i've set the name of each set of radion button as the name of the candidate, and this is done by using a for loop and an array( ass you can see in the code below)
echo '<form action="registervote.php" method="post">';
echo '<table align="center" cellspacing="50" cellpadding="5" border="2">';
echo '<tr>';
for($i=1; $i<=$num; $i++)
{
$arr1=mysql_fetch_array($result, MYSQL_ASSOC);
echo '<th align="center" bgcolor="yellow">' . $arr1['name'] . '</th>';
while(!$i)
{
echo '</tr><tr>';
}
for($j=0; $j<=$num; $j++)
{
echo '<td align="center">'.($j+1).'<input type="radio" name="'.$arr1['name'].'" value="'($j+1).'"/></td>';
}
echo '</tr>';
}
echo '</table>';
echo '<p><br /><center/><input type="submit" name="submit" value="VOTE!" /></p>';
echo '<input type="hidden" name="submitted" value="TRUE" />';
the handling script is below, what i need it to do is to confirm that an input has been selected(then i can add the input value into my MySQL database table):
if(isset($_POST['submitted']))
{
if(isset($_POST['']))
{
echo '<p>input has been selected</p>';
}
else
{
echo 'no input';
}
}
what i haven't been able to figure out for two days is what i should write in the $_POST[] array to handle the radio button. all the radio buttons would have their names set as the candidate name in the ballot that they would be taking part in. so i cant just set each set of radio buttons' name as the name of each candidate manually, as these can change for each ballot. i dont know how to check if the name of the radio button(which is an array) has been set, using the isset() function. please help.