j05hr Posted November 24, 2009 Share Posted November 24, 2009 How can I write this to say checked="checked" { echo "checked"; } Thanks, Josh Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted November 24, 2009 Share Posted November 24, 2009 How can I write this to say checked="checked" { echo "checked"; } Thanks, Josh What's the context? Are you merely trying to echo that string, or are you trying to set the checked attribute of a checkbox or radio button? Quote Link to comment Share on other sites More sharing options...
sawade Posted November 24, 2009 Share Posted November 24, 2009 Drop Menu <select name="name" id="name"> <option value="Mr" <?php if(isset($_POST['name']) && $_POST['name'] == 'Mr') { echo 'selected="selected"'; } ?> >Mr</option> </select> Radio <input type="radio" name="yes" id="yes" value="Is Yes" <?php if(isset($_POST['yes']) && $_POST['yes'] == 'Is Yes') { echo 'checked="checked"'; } ?> />Yes Checkbox <input type="checkbox" name="checkbox[]" id="name" value="Value01" <?php if (isset ($_POST['checkbox']) && in_array ("Value01", $_POST['checkbox'])) echo ' checked="checked"'; ?> />Field Name Quote Link to comment Share on other sites More sharing options...
j05hr Posted November 24, 2009 Author Share Posted November 24, 2009 Sorry I solved it myself, I was trying to put it in double quotes instead of single. For anyone that has the same problem and wants the solution, here it is { echo ' selected="selected"'; } Quote Link to comment Share on other sites More sharing options...
sawade Posted November 24, 2009 Share Posted November 24, 2009 Good to hear.... Remember to hit the solved button on the bottom. Quote Link to comment Share on other sites More sharing options...
j05hr Posted November 24, 2009 Author Share Posted November 24, 2009 I may be going blind but I can't see it anywhere on the new forum lol sorry for bumping more Quote Link to comment Share on other sites More sharing options...
Anzeo Posted November 24, 2009 Share Posted November 24, 2009 I may be going blind but I can't see it anywhere on the new forum lol sorry for bumping more That's normal, the mod isn't configured yet for the new version of this forum. 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.