PHP code example of flsouto / htselect

1. Go to this page and download the library: Download flsouto/htselect library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flsouto / htselect example snippets



lSouto\HtSelect;

$select = new HtSelect("id_category");
$select->options([1=>'Category1',2=>'Category2',3=>'Category3']);

echo $select;


lSouto\HtSelect;

$select = new HtSelect('id_category');
$select->options([1=>'Category1',2=>'Category2',3=>'Category3']);
$select->context(['id_category'=>2]);

echo $select;


lSouto\HtSelect;

$select = new HtSelect('id_category');
$select->options([1=>'Category1',2=>'Category2',3=>'Category3']);
$select->caption('CHOOSE A CATEGORY:');

echo $select;


lSouto\HtSelect;

$select = new HtSelect('id_category');
$select->options([1=>'Category1',2=>'Category2',3=>'Category3']);
$select->caption('CHOOSE A CATEGORY:', 'none'); # change value to 'none'

echo $select;