Page 1 of 1

Radio Buttons and Default Values

Posted: Sun Apr 01, 2007 7:28 am
by Adrianc333
Hey,

I have done a quick search on the internet, and these forums before posting this.

Anyway, here's my question. :)

In my MySql DB, i have a field called "enabled", this is a INT.
In my script, i have Two Radio Buttons.

For example,

Enable this Function: (Button) Yes (Button) No

So, how would i get one of those Radio Buttons, to be checked, depending on the Value in my Enabled Field/Row? (1 or 0)

Any help would be greatly appreciated!

Thanks
Adrian

Posted: Sun Apr 01, 2007 9:44 am
by s.dot

Code: Select all

<input type="radio" name="somename"<?php if($row['enabled'] == 1){  echo ' checked'; } ?> />

Posted: Sun Apr 01, 2007 10:34 am
by Adrianc333
Thanks, i though it could be something like that.

I just have a bunch of them to do. :(