Instead of having 2 inputs with the full-time and the contractor box ticked, I have 4 inputs see below. How can I avoid the duplication of the inputs, and ends up with two inputs only that will have the boxes ticked for full-time and contractor?
Here is the code:
<?php
$jobEmploymentType = "FULL_TIME,CONTRACTOR";
$jobEmploymentTypeExplode = (explode(",",$jobEmploymentType));
//print_r($jobEmploymentTypeExplode);
foreach ($jobEmploymentTypeExplode as $jobType) : ?>
<span class="asterisk">*</span> <label for="jobEmploymentType">Employment Type</label><br>
<input type="checkbox" class="w3-check" id="fullTime" name="fullTime" value="FULL_TIME" <?= ($jobType == "FULL_TIME")? "checked":"";?>>
<label for="fullTime"> FULL-TIME</label><br>
<input type="checkbox" class="w3-check" id="contractor" name="contractor" value="CONTRACTOR" <?= ($jobType == "CONTRACTOR")? "checked":"";?>>
<label for="contractor"> CONTRACTOR</label><br>
<?php endforeach; ?>
Expecting result:
Aucun commentaire:
Enregistrer un commentaire