Reputation: 1
I retrieved the value from database and I want to print it in radio button as given below.
<input type="radio" value="<?php $row['Username']; ?>" name="myradiobutton" />
While storing the 'Username' in the attribute - "value", it's not working. Can any one please clarify my doubt.
Upvotes: 0
Views: 229
Reputation: 270599
You need to output the value with echo
. Also escape it with htmlentities()
as suggested in Fabio M's comment.
<input type="radio" value="<?php echo htmlentities($row['Username'], ENT_QUOTES); ?>" name="myradiobutton" />
^^^^^^
Upvotes: 4
Reputation: 10340
For the ones that want to know there is also a short tag for this:
<input type="radio" value="<?=$row['Username']?>" name="myradiobutton" />
Upvotes: 1