Is there anyway i could dynamically fetch the value of an <option> and pass it to PHP without using AJAX?
<p>I have two <code>&lt;select&gt;</code> one is category and the second is subcategory. </p>

<p>here is the first <code>&lt;select&gt;</code> for category.</p>

<pre><code>&lt;select name="category" size="10"&gt;
    &lt;?php foreach($categories-&gt;fetch(array('table' =&gt; 'categories')) as $category) { ?&gt;
        &lt;option value="&lt;?php echo $category['id']; ?&gt;"&gt;&lt;?php echo $category['name']; ?&gt;&lt;/option&gt;
    &lt;?php } ?&gt;
&lt;/select&gt;
</code></pre>

<p>now the second <code>&lt;select&gt;</code> i.e subcategory should be hidden initially and when a user click on category <code>&lt;select&gt;</code> based on the value it should populate the value in subcategory. </p>

<p>One way of doing this is via AJAX by passing categoryId as POST Request and getting HTML as response.</p>

<p>however i would like to know if there is any other alternative so that it automatically pass the categoryId value to PHP and unhide the second <code>&lt;select&gt;</code> here is the code of second <code>&lt;select&gt;</code></p>

<pre><code>&lt;select name="subcategory" size="10"&gt;
    &lt;?php foreach($categories-&gt;fetch(array('table' =&gt; 'subCategories', 'categoryId' =&gt; $categoryId)) as $subCategory) { ?&gt;
        &lt;option value="1"&gt;&lt;?php echo $subCategory['name']; ?&gt;&lt;/option&gt;
    &lt;?php } ?&gt;
&lt;/select&gt;
</code></pre>

<p>the only thing i need here is $categoryId to be populated dynamically. is there any way of doing this?</p>

<p>thank you..</p>
