Answer the question
In order to leave comments, you need to log in
How to retrieve value from database?
Hello. There is such a thing
<select name="status" class="select_option input_form">
<option value="0">Статус</option>
<option value="1">Завершен</option>
<option value="2">Идут работы</option>
</select>
Answer the question
In order to leave comments, you need to log in
Well, in theory, you can create an array of statuses (or any similar method):
$statuses = array(
1 => 'Завершен',
2 => 'Идут работы',
);
$status = ... // 1 или 2 значение из базы
echo $statuses[$status];
// Выведет 'Завершен' или 'Идут работы'
$statuses = array(
1 => '<img src="кружочек">',
2 => '<span class="надпись с фоном"></span>',
);
echo $statuses[$status];
// Соответственно либо надпись либо кружочек
<?php $status = (int)...; // 1 или 2 значение из базы ?>
<?php if ($status === 1) { ?>
<img src="кружочек">
<?php } elseif ($status === 2) { ?>
<span class="фон">Надпись</span>
<?php } ?>
"1" is just a string. Accordingly, it can be any special character, such as html or acsii. For example & bull ; or \x248 (cp866).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question