Answer the question
In order to leave comments, you need to log in
How to split the string correctly in this case?
There is a field:
There is a select:
<select name="">
<?php
$type_service = get_field('type_service', 15);
$arr_type_service = explode(" ", $type_service);
foreach ($arr_type_service as $i) { ?>
<option value="<?php echo $i ?>"><?php echo $i ?></option>
<?php } ?>
</select>
<option value="300">Услуга</option>
<option value="400">Услуга два</option>
Answer the question
In order to leave comments, you need to log in
No need to break anything, you are using the ACF plugin incorrectly. Change the values for the select to:
300 : Услуга один
400 : Услуга два
$type_service = get_field('type_service', 15);
foreach ( $type_service as $key => $value ) {
echo "<option value=\"{$key}\">{$value}</option>"; // <option value="300">Услуга один</option>
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question