单击 php 中的编辑按钮后单选按钮未编辑
Radio button not edit after clicking on edit button in php
单击编辑按钮后未选中单选按钮。我正在尝试 edit/update 数据,但未在表单中编辑值。
<div class="form-group col">
<label>*Gender:-</label>
<div class="form-group col">
<input type='radio' name='gender' value='Male'
// check for male value
```
<?php
if(isset($row['gender']) == 'Male') {
echo "checked";
}
?> ``` >
<label>Male</label>
<input type='radio' class='ml-3' name='gender' value='Female'
// check for female value
```<?php
if(isset($row['gender']) == 'Female') {
echo "checked";
}
?> ```>/* radio value is not edited or selected after clicking on edit button */
<label>Female</label>
</div>
</div>
<?php $row['gender'] = 'Male'; ?> //for checking
<?php isset($row['gender']) ? $gender = $row['gender'] : $gender = '' ?> //ternary operator...if you need you can use if..else
<div class="form-group col">
<label>*Gender:-</label>
<div class="form-group col">
<input type='radio' name='gender' value='Male'
<?php
if($gender == 'Male'){ echo "checked"; } else { echo ""; } ?> >
<label>Male</label>
<input type='radio' class='ml-3' name='gender' value='Female'
<?php
if($gender == 'Female'){ echo "checked"; } else { echo ""; } ?> >
<label>Female</label>
</div>
</div>
单击编辑按钮后未选中单选按钮。我正在尝试 edit/update 数据,但未在表单中编辑值。
<div class="form-group col">
<label>*Gender:-</label>
<div class="form-group col">
<input type='radio' name='gender' value='Male'
// check for male value
```
<?php
if(isset($row['gender']) == 'Male') {
echo "checked";
}
?> ``` >
<label>Male</label>
<input type='radio' class='ml-3' name='gender' value='Female'
// check for female value
```<?php
if(isset($row['gender']) == 'Female') {
echo "checked";
}
?> ```>/* radio value is not edited or selected after clicking on edit button */
<label>Female</label>
</div>
</div>
<?php $row['gender'] = 'Male'; ?> //for checking
<?php isset($row['gender']) ? $gender = $row['gender'] : $gender = '' ?> //ternary operator...if you need you can use if..else
<div class="form-group col">
<label>*Gender:-</label>
<div class="form-group col">
<input type='radio' name='gender' value='Male'
<?php
if($gender == 'Male'){ echo "checked"; } else { echo ""; } ?> >
<label>Male</label>
<input type='radio' class='ml-3' name='gender' value='Female'
<?php
if($gender == 'Female'){ echo "checked"; } else { echo ""; } ?> >
<label>Female</label>
</div>
</div>