Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I add extra space or dashed symbol to select option?
    primarykey
    data
    text
    <p>I want to make a select tree for my category. Here is for unordered list.</p> <pre><code>function generate_menu($parent, $menu_array = null) { $has_childs = false; foreach ($menu_array as $key =&gt; $value) { if ($value['parent'] == $parent) { if ($has_childs === false) { $has_childs = true; echo "&lt;ul&gt;\n"; } echo '&lt;li&gt;&lt;a href="#"&gt;'.$value['name'].'&lt;/a&gt;'; generate_menu($key, $menu_array); echo "&lt;/li&gt;\n"; } } if ($has_childs === true) echo "&lt;/ul&gt;\n"; } </code></pre> <p>Here is the HTML output for unordered list.</p> <pre><code>&lt;ul&gt; &lt;li&gt; Ford &lt;ul&gt; &lt;li&gt; Falcon &lt;ul&gt; &lt;li&gt; Futura &lt;ul&gt; &lt;li&gt;FPV&lt;/li&gt; &lt;li&gt;GT&lt;/li&gt; &lt;li&gt;F6&lt;/li&gt; &lt;li&gt;GS&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;F150&lt;/li&gt; &lt;li&gt;Festiva&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>Question</strong> : How to make the current function for <code>select option</code> and the results will be something like this.</p> <pre><code>&lt;select name="categories"&gt; &lt;option value="Ford"&gt;Ford&lt;/option&gt; &lt;option value="Falcon"&gt;-Falcon&lt;/option&gt; &lt;option value="Futura"&gt;--Futura&lt;/option&gt; &lt;option value="FPV"&gt;--FPV&lt;/option&gt; &lt;option value="GT"&gt;---GT&lt;/option&gt; &lt;option value="F6"&gt;---F6&lt;/option&gt; &lt;option value="GS"&gt;---GS&lt;/option&gt; &lt;option value="F150"&gt;-F150&lt;/option&gt; &lt;option value="Festiva"&gt;-Festiva&lt;/option&gt; &lt;/select&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload