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? Quote Link to comment 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> Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.