Created
September 26, 2020 01:03
-
-
Save alexandreelise/44336b458b095c5b4e97abc3b0fd405c to your computer and use it in GitHub Desktop.
Code snippet for HTMLHelper select options with empty default value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<label for="demo">Demo</label> | |
<select id="demo" name="demo"> | |
<?php array_unshift($this->myExampleOptionsArray, null); ?> | |
<?php echo HTMLHelper::_('select.options', $this->myExampleOptionsArray, 'value', 'text', $this->selectedOptionValue ?? '');?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment