PHP. How dynamically change page content on HTML select action?
<p>I have this code:</p>

<p><strong>page.php:</strong></p>

<pre><code>&lt;?php

include ('include.php');

echo = '
&lt;li&gt;
    &lt;select name="selector" class="letter"&gt;
        &lt;option value="a" selected="selected"&gt;$a&lt;/option&gt;
        &lt;option value="b"&gt;$b&lt;/option&gt;
    &lt;/select&gt;
&lt;/li&gt;
';

echo = '
&lt;li&gt;
    &lt;select name="a-numbers" class="number a-numbers"&gt;
        &lt;option value="$a[1][1]"&gt;$a[1][2]&lt;/option&gt;
        &lt;option value="$a[2][1]"&gt;$a[2][2]&lt;/option&gt;
    &lt;/select&gt;
    &lt;select name="b-numbers" class="number b-numbers"&gt;
        &lt;option value="$b[1][1]"&gt;$b[1][2]&lt;/option&gt;
        &lt;option value="$b[2][1]"&gt;$b[2][2]&lt;/option&gt;
    &lt;/select&gt;
&lt;/li&gt;
';

?&gt;
</code></pre>

<p>&amp;</p>

<p><strong>include.php:</strong></p>

<pre><code>&lt;?php

$array = array(
    "a" =&gt; array(
        "1" =&gt; array("aaa1-value","aaa1-text"),     
            "2" =&gt; array("aaa2-value","aaa2-text")      
        ),  
        "b" =&gt; array(
            "1" =&gt; array("bbb1-value","bbb1-text"),     
            "2" =&gt; array("bbb2-value","bbb2-text")      
        )   
    )
);

?&gt;
</code></pre>

<p>If <em><code>.letter&gt;a</code></em> is selected, <em><code>.a-numbers</code></em> list should be echo-printed; and if <em><code>.letter&gt;b</code></em> is selected, <em><code>.a-numbers</code></em> list should be removed and <em><code>.b-numbers</code></em> should be printed.</p>

<p>Of course, I can create this scenario with JS and CSS <code>display:none</code>; however, I can't use <code>display:none</code> here. So I have to remove elements from DOM, but I can't.</p>

<p>Thanks for your attention.</p>
