also it's more of a html problem, than a php, so feel free to move it if it doesn't belong in this section
the thing is, i'm trying to create a poll with multiple choices that should return a value on each of the choices
a picture to help understand it easier
i have made a script (vote.php) that takes the user chosen value and makes all the calculations etc, but now i can make it so that only one value is returned.
how to return multiple values? so that every choice (opt1, opt2, etc.) returned one of the two (+ or -) values
here's the code i've been messing around:
<table>
<tr>
<td>
<em><?=$header?></em><br />
<form action="vote.php" method="post">
<hr />
<p><input name="choice0" type="radio" value="0" /> <input name="choice00" type="radio" value="0" /> <?=$choices[0]?> </p>
<p><input name="choice1" type="radio" value="1" /> <input name="choice01" type="radio" value="1" /> <?=$choices[1]?> </p>
<? if(isset($choices[2]) && trim($choices[2]) != "") { ?>
<p><input name="choice2" type="radio" value="2" /> <input name="choice02" type="radio" value="2" /> <?=$choices[2]?> </p>
<? } if(isset($choices[3]) && trim($choices[3]) != "") { ?>
<p><input name="choice3" type="radio" value="3" /> <input name="choice03" type="radio" value="3" /> <?=$choices[3]?> </p>
<? } if(isset($choices[4]) && trim($choices[4]) != "") { ?>
<p><input name="choice4" type="radio" value="4" /> <input name="choice04" type="radio" value="4" /> <?=$choices[4]?> </p>
<? } if(isset($choices[5]) && trim($choices[5]) != "") { ?>
<p><input name="choice5" type="radio" value="5" /> <input name="choice05" type="radio" value="5" /> <?=$choices[5]?> </p>
<? } if(isset($choices[6]) && trim($choices[6]) != "") { ?>
<p><input name="choice6" type="radio" value="6" /> <input name="choice06" type="radio" value="6" /> <?=$choices[6]?> </p>
<? } if(isset($choices[7]) && trim($choices[7]) != "") { ?>
<p><input name="choice7" type="radio" value="7" /> <input name="choice07" type="radio" value="7" /> <?=$choices[7]?> </p>
<? } if(isset($choices[8]) && trim($choices[8]) != "") { ?>
<p><input name="choice8" type="radio" value="8" /> <input name="choice08" type="radio" value="8" /> <?=$choices[8]?> </p>
<? } if(isset($choices[9]) && trim($choices[9]) != "") { ?>
<p><input name="choice9" type="radio" value="9" /> <input name="choice09" type="radio" value="9" /> <?=$choices[9]?> </p>
<? } ?>
<hr />
<p><strong><?=$total_votes?></strong> total <br /><br /></p>
<? if(!in_array($user,$users)) { ?>
<p><input name="submit" type="submit" value="vote" /></p>
<? } else { ?>
<p><em>vote casted</em></p>
</form>
<form action="delete.php" method="post">
<p><input name="submit" type="submit" value="change vote" /></p
</form>
<? } ?>
</td>
</tr>
</table>
where $choices and $user is read form a txt file
if there are any questions feel free to ask.
any help would be appreciated
thanks


Sign In
Create Account

Back to top










