Answer the question
In order to leave comments, you need to log in
What's the best way to template output in a select tag?
<select name="StandardProductIDType" id="StandardProductIDType" class="TxtField">
<option value="None">keine</option>
<option value="ASIN">ASIN (Amazon)</option>
<option value="EAN" selected="selected">EAN</option>
<option value="GTIN">GTIN</option>
<option value="ISBN">ISBN</option>
<option value="UPC">UPC</option>
</select>
Answer the question
In order to leave comments, you need to log in
<?php
$results = array(
array(
'value' => 'None',
'name' => 'keine',
'selected' => false),
array(
'value' => 'ASIN',
'name' => 'ASIN (Amazon)',
'selected' => false),
array(
'value' => 'EAN',
'name' => 'EAN',
'selected' => true),
array(
'value' => 'GTIN',
'name' => 'GTIN',
'selected' => false),
array(
'value' => 'ISBN',
'name' => 'ISBN',
'selected' => false),
array(
'value' => 'UPC',
'name' => 'UPC',
'selected' => false),
);
?>
<select name="StandardProductIDType" id="StandardProductIDType" class="TxtField">
<? foreach ($results as $result): ?>
<option value="<?= $result['value']; ?>" <?= ($result['selected'] ?
'selected="selected"' : null); ?>><?= $result['name']; ?></option>
<? endforeach; ?>
</select>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question