I created a radio button in which when user click on yes value then text box is shown to user otherwise they remain hide.
My question when user select yes then I am able to store yes value in sql but when user click on no value that value is not stored in datbase
<script>
$(document).ready(function(){
$(function() {
$('input[name="yeshave"]').on('click', function() {
if ($(this).val() == 'yes') {
$('#textboxes').show();
} else {
$('#textboxes').hide();
}
});
});
});
</script>
no radio button code:
<table>
<tr>
<td>Do you haver passport:</td>
<td><input type="radio" name="yeshave" value="yes"> Yes</td>
<td><input type="radio" name="yeshave" value="no"> No</td>
</tr>
</table>
SQL code is:
if(isset($_POST['yeshave']))
{
$selectedValue=$_POST['yeshave'];
}
$query = "INSERT INTO upload (name, size, type, image,passport_no,dateofissue,dateofexpiry,placeofissue, having_passport ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$image','".$passno."','".$doi."','".$doe."','".$poi."','".$selectedValue."')";
mysqli_query($conn,$query) or die('Error, query failed');