I am currently facing 2 problems right now:
- I want to make my checkbox appear if my driver license is yes, so I decided to try using
if else
in this scenario but I seem to keep getting this error:
Parse error: syntax error, unexpected '<'
Can someone tell me the proper way to do it?
- I want to check my checkbox based on my database value, so for example if class A and Class B is already selected and saved in the database last time, I want them to be checked.
I have tried following other people example to do but nothing is happening.
I tried following here, but still not checked:
Here is the code:
<div class="editfield">
<div class="radio">
<span><b>Do you have a Driver`s license?</b></span>
<div id="Driver_licenseID">
<label><input type="radio" name="Driver_license" id="yesid" value="Yes" onclick="document.getElementById('Driver_license').style.display='block'" >Yes</label>
<label><input type="radio" name="Driver_license" id="noid" value="No" onclick="document.getElementById('Driver_license').style.display='none'" >No</label></div>
</div>
</div>
@if ()
<div class="editfield" id="Driver_license" required>
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class1" value="Class 1">Class 1
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class2" value="Class 2">Class 2 <br>
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class3" value="Class 3">Class 3
</div>
@endif
@if()
<div class="editfield" id="Driver_license" style="display:none">
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class1" value="Class 1">Class 1
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class2B"
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class2" value="Class 2">Class 2 <br>
<input type="checkbox" name="Driver_license_class[]" id="Driver_license_class3" value="Class 3">Class 3
</div>
@endif
Aucun commentaire:
Enregistrer un commentaire