Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>May be you are searching for AJAX methods? E.g. you send request to some of your PHP files with GET or POST variable for your <code>key</code> (which user selects in <code>optPostAppliedFor</code>) and that PHP script <em>echo'es</em> the needed result, so JS could use it.</p> <p>For example, with jQuery this would look like this:</p> <pre><code>$("select[name=optCategory]").load("myUberScript.php", { key: $("select[name=optPostAppliedFor]").attr("selected") }); </code></pre> <p><em>myUberScript.php</em>:</p> <pre><code>&lt;?php $key = $_POST['key']; if (isset($key)) { if ($key == 'moo') echo "&lt;option&gt;moo&lt;/option&gt;"; else if ($key == 'foo') echo "&lt;option&gt;foo&lt;/option&gt;"; } ?&gt; </code></pre> <p>I think this would be the best way, but i'm really not sure with my <code>.attr("selected")</code> selector. And i recommend you to read something 'bout AJAX and jQuery - these are very useful when web-developing =)</p> <p>So, what does this JS do? It finds your <code>select</code> tag with name <code>optPostAppliedFor</code>, gets all its 'selected' items (<strong>be sure to verify that code - i am not sure about it</strong>), sends POST request to <em>myUberScript.php</em> passing that values as <code>$_POST['key']</code> argument, gets response, finds div named <code>optCategory</code> and sets its inner HTML code to PHP's response. Pretty nice, huh? =)</p> <p>I recommend this way beacause it is not always good for user to get all the internal data within javascript - user could see that data and if there is a lot of data, the page would load slooowly. Second: you can manage/edit/update/modify (choose the right one) your PHP code whenever you want. Third: PHP code has more features for secure verifying user' data and lots more. But there is one great disadvantage: if user disables JS support in his browser, you would not be able to do this sort of trick. <strong>Notice</strong>: this is a very rare case when user disables JS =)</p>
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      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