Hi,
I have a poll table that contains the questions and the code below displays the questions with radio buttons. I get $q values from database. Now, I dont have 5 questions all the time. Sometimes I have less. Lets say I have three questions, the code below displays 4th and 5th buttons regardless. How can I make it automatically display the appropriate number of options? (i.e. if I have 3 questions, immediately after displaying the third option, it needs to display the submit button)
I tried if statement, but my php knowledge is not enough how to make it work.
<form method=”post” action=”updateanswers.php”>
<?php echo $title; ?>
</br>
<input type=”radio” name=”answer” value=”answer1″>
<?php echo $q1; ?>
</br>
<input type=”radio” name=”answer” value=”answer2″>
<?php echo $q2; ?>
</br>
<input type=”radio” name=”answer” value=”answer3″>
<?php echo $q3; ?>
</br>
<input type=”radio” name=”answer” value=”answer4″>
<?php echo $q4; ?>
</br>
<input type=”radio” name=”answer” value=”answer5″>
<?php echo $q5; ?>
</br>
<input type=”submit” value=”submit my answer”/>
</form>