in Advanced 

Question preview

HomeQuestion preview:
Log in

question in php......

<input type="radio" name="q2" value="1" />
here get the value usung by $v=$_POST['q2'];


The Below a value set by the my database..... in html form.
<input type="radio" name="<?php echo $row['qid'];?>" value="<?php echo $row['ans1'];?>" />

here how i get the radio value in php?
Do you know someone who could answer? Ask him for help
Answers: 1
Sort by: date rating
image xpert
12:36/08.04.2008
1 from possible 5 with 4 votes
You have to know which radio will be selected by holding answer in some variable, for exmaple $givenanswer. Well if $givenanswer is empty - no problem, nothing will be selected

<input type="radio" name="<?php echo $row['qid'];?>" value="<?php echo $row['ans1'];?>"  <?php if ($givenanswer==$row['ans1']){ echo 'checked="checked" ';}?> />

Vote:
Please vote! Your opinion matters!
If you haven't found what you've looking for, post a question
Ask question
| Home | Hall of fame | Registration | Log in | Terms of service | Privacy policy | Help | Contacts | RSS |