
  <div class="row mb-3">
    <div class="col-lg-3 col-md-4">
      <?php
      if ($field_title !='') {
        ?>
        <label class="d-block mb-0" for="<?php echo $field_id ?>"><?php echo $field_title ?></label>
        <?php
      }
      if ($field_subtitle !='') {
        ?>
        <small><?php echo $field_subtitle ?></small>
        <?php
      }
       ?>
    </div>

    <?php
    // Convert Stored Value to array
    $form_value_array = explode(',', $form_value);
    ?>

    <div class="col-md-8">
      <div class=" border rounded-2 p-2">
        <div class="row">
          <div class="<?php echo $field_plc_img_size ?>">
            <img  id="<?php echo $field_id ?>headerImage" class="w-100 mb-2" src="<?php echo $site_domain.$field_plc_img.$form_value.'.png'  ?>" alt="">
          </div>
        </div>
        <div class="form-group">
          <select onchange="change<?php echo $field_id ?>Image(this)" name="<?php echo $field_id ?>" class="form-select form-select-sm"  id="<?php echo $field_id ?>"  <?php   echo ($field_required == true) ? 'required' : '';     ?>>
            <?php
              foreach ($field_options as $optionsvalue => $option_single) {
                 ?>
                ?>
                    <option
                      value="<?php echo $optionsvalue; ?>"
                      <?php
                        if(in_array($optionsvalue, $form_value_array)){
                          echo "selected";
                        }
                       ?>
                      >
                      <?php echo $option_single; ?>
                    </option>
                <?php
              }
            ?>
          </select>
           <?php
            if ($field_desc !='') {
              ?>
              <small><?php echo $field_desc ?></small>
              <?php
            }
          ?>
        </div>
      </div>
    </div>
    <script>
      // JavaScript function to change the image source
      function change<?php echo $field_id ?>Image(select) {
          const selectedValue<?php echo $field_id ?> = select.value;
          const imagePath<?php echo $field_id ?> = `<?php echo $site_domain.$field_plc_img  ?>${selectedValue<?php echo $field_id ?>}.png`;
          document.getElementById('<?php echo $field_id ?>headerImage').src = imagePath<?php echo $field_id ?>;
      }
  </script>
  </div>
