Note that there are some explanatory texts on larger screens.

plurals
  1. POsecond dropdown based on selection of first dropdown using script and PHP/MySQL
    primarykey
    data
    text
    <p>The first dropdown box will be populated when the page loads based on values from a database. The second dropdown box should display a set of values based on the selection from the first dropdown box. I know there have been similar questions asked on here before, but I haven't found a solution that matches my scenario.</p> <p>UI code:</p> <pre><code>&lt;tr&gt; &lt;td&gt;&lt;label for="taProj"&gt;&lt;?php echo t('Project')?&gt;:&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;select name="taProj" id="taProj" onchange= "get_module()"&gt; &lt;option value="" &gt;-------------------------&lt;/option&gt; &lt;?php foreach ($tap as $row){?&gt; &lt;option value="&lt;?php echo $row['proj_id']; ?&gt;" &gt;&lt;?php echo $row['proj_name'];?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="taModule"&gt;&lt;?php echo t('Module Name')?&gt;:&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;select name="taModule" id="taModule" &gt; &lt;option value="" &gt;-------------------------&lt;/option&gt; &lt;?php foreach ($tam as $row){?&gt; &lt;option value="&lt;?php echo $row['mod_id']; ?&gt;" &gt;&lt;?php echo $row['mod_name'];?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;script type="text/javascript"&gt; function get_module(){ var projid = document.getElementById('taProj').value; alert(projid); } &lt;/script&gt; </code></pre> <p>mycontroller.php</p> <pre><code>public function sample(){ echo $_GET['projid']; } </code></pre> <p>its working properly.. My need is...</p> <p>How to call mycontroller.php file function sample() and how to pass the javascript value to the php function parameter.</p> <p>I new in the script and jquery. please any suggest me... thanks</p> <p>Kumar</p>
    singulars
    1. This table or related slice is empty.
    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.
    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