is it possible to do some function inside html content ?
here my code :
$parts = explode(',', 'option 1,option 2,option 3');
echo "<div class='form-group'>
<div class='col-sm-12'>
<label>label</label>
<select class='form-control' style='width: 100%;' name='select' placeholder='select'>
foreach($parts as $index=>$key) {
echo '<option>'.$key .'</option>';
}
</select>
</div>
</div>";
Do this think like this way:
Depart the HTML and PHP, use the PHP tag each time when you need inside a HTML page / PHP page.
<?php
$parts = explode(',', 'option 1,option 2,option 3');
?>
<div class='form-group'>
<div class='col-sm-12'>
<label>label</label>
<select class='form-control' style='width: 100%;' name='select' placeholder='select'>
<?php
foreach($parts as $index=>$key){
?>
<option><?php echo $key;?></option>
<?php }?>
</select>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With