morocco-iceberg Posted June 1, 2010 Share Posted June 1, 2010 Just wondering how to preset radio buttons dynamically using php. Say, pull data from a database table and use that to select which radio button of a group should be automatically checked? Link to comment https://forums.phpfreaks.com/topic/203510-dynamically-preset-radio-buttons/ Share on other sites More sharing options...
GetPutDelete Posted June 1, 2010 Share Posted June 1, 2010 Something like this... <label> <input type="radio" name="radio" id="radio" value="radio"<?php if(mysql_num_rows(mysql_query(...)) == 1) { echo ' checked'; } ?> ></label> Link to comment https://forums.phpfreaks.com/topic/203510-dynamically-preset-radio-buttons/#findComment-1066096 Share on other sites More sharing options...
morocco-iceberg Posted June 1, 2010 Author Share Posted June 1, 2010 Oooh, that makes sense, I'll try that! Thanks Link to comment https://forums.phpfreaks.com/topic/203510-dynamically-preset-radio-buttons/#findComment-1066098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.