Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radio button checked property

How can I know if the radio button checked property is true in PHP, can anyone give me an example?

Thanks..

like image 703
aintgel Avatar asked Oct 20 '10 09:10

aintgel


1 Answers

After submitting your form, in $_POST (or $_GET respectively) you'll have a key with your radio button name and value with your radio button value, if it was checked. Otherwise, there will be no such key at all.

So <input type="radio" name="test" value="checked!" checked="checked" /> Will produce $_POST['test'] == 'checked!'

like image 175
NOtherDev Avatar answered Sep 20 '22 11:09

NOtherDev