开发者

PHP: how to mark a radio button as checked on pageload?

开发者 https://www.devze.com 2022-12-27 13:12 出处:网络
I\'m looking for an at开发者_开发技巧tribute like checked=\"checked\" for checkboxes which i can echo out in php..That would be checked=\"checked\"<?php echo \'checked=\"checked\"\'; ?>

I'm looking for an at开发者_开发技巧tribute like checked="checked" for checkboxes which i can echo out in php..


That would be checked="checked"


<?php echo 'checked="checked"'; ?>


HTML solution:

<input type="radio" name="imgsel" value="" checked="checked" />

Please note, that the actual value of checked attribute does not actually matter; it's just a convention to assign "checked". Most importantly, strings like "true" or "false" don't have any special meaning.

If you don't aim for HTML conformance, you can simplify the code to:

<input type="radio" name="imgsel" value="" checked>

I hope its helpful for you

0

精彩评论

暂无评论...
验证码 换一张
取 消