why not getting the checked value ? my code on edit page
<input name="gender" value="Male" value="<?php echo $students['gender'] ? 'checked' : '' ?>" class=" border border-black rounded-full py-5 px-3 mr-16 " id="grid-first-name" type="radio">
You are setting the value as checked but checked is an attribute.. try this:
<input name="gender" value="Male" <?php echo $students['gender'] ==='Male' ? 'checked' : '' ?> class=" border border-black rounded-full py-5 px-3 mr-16 " id="grid-first-name" type="radio">
@Nakov this is also not working 🥺
@Shivamyadav if you print out the value of the gender what does it says?
Add this above the input in your view:
@dd($students['gender'])
@Nakov here it is same
string(4) "Male"
@Shivamyadav instead of checked change it to selected. BTW I hope you don't have any JavaScript code related to the input fields that is changing your state. Otherwise one of those two should work, I don't see any other reason.
@Nakov i have solved it sir , btw thanks. 🙏
@Shivamyadav haha, great job. It is good to share how you solved it, maybe it will help someone else.
Please sign in or create an account to participate in this conversation.