4
4
4sadly2020-04-27 11:51:39
PHP
4sadly, 2020-04-27 11:51:39

Can it be done faster?

It is necessary to save this value, and then substitute it, can it be done faster / prettier / better?

<select name="status">
    <option value="0" <?php if ($status == 0) { ?> selected disabled<?php } ?>>Выберите статус</option>
    <option value="1" <?php if ($status == 1) { ?> selected <?php } ?> >one</option>
    <option value="2" <?php if ($status == 2) { ?> selected <?php } ?> >two</option>
    <option value="3" <?php if ($status == 3) { ?> selected <?php } ?> >three</option>
</select>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-04-27
@4sadly

It can't be faster.
You can do better. Depends on the definition of what is "better".
For example, you can write the changing values ​​\u200b\u200bin an array and display the elements in a loop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question