Note that there are some explanatory texts on larger screens.

plurals
  1. POfilling innerhtml of dropdown menu with specific data
    primarykey
    data
    text
    <p>I have a xmlhttp/php problem. I have one drop-down menu where people are able to select municipality. Then I want to return a list of possible options within that municipality to a secondary drop-down menu.</p> <p>people first select a municipality (html code below):</p> <pre><code>&lt;select name="pszplaats" id="gemeente" onchange="fdisplay();loadXMLDoc(this.value)"&gt; &lt;?php while($row=mysql_fetch_array($selectgem)){?&gt; &lt;option value="&lt;?php echo $row['Gemeente']; ?&gt;"&gt;&lt;?php echo $row['Gemeente'];?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; </code></pre> <p>loadXMLDoc is the function that should send this answer to the (php-)server and retreive a list of names matching those in that municipality. so far my relevant java/xml/ajax code is this:</p> <pre><code>function loadXMLDoc() { var xmlhttp; gem=document.getElementById("gemeente").value; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById("test").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","http://www.doenwatikkan.nl/jeroen/dynamic.php",true); xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlhttp.send(); alert(gem) } </code></pre> <p>Alert(gem) shows the selected option, so I know that at least this works. the php to retreive the right values is this:</p> <pre><code>$gem=$_POST["pszplaats"]; $gennam=mysql_query("SELECT * FROM psz WHERE Gemeente=$gem"); echo $gennam["$gem"]; </code></pre> <p>now the problem lies in the filling of the secondary drow-down menu</p> <pre><code>&lt;select name="psznaam" id="test" style="display:none"&gt; &lt;?php while($row=mysql_fetch_array($selectall)){?&gt; &lt;option value="&lt;?php echo $row['NaamPSZ']; ?&gt;"&gt;&lt;?php echo $row['NaamPSZ'];?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; </code></pre> <p>after the java function is finished the drop-down menu is completely empty. Can anybody tel me how I can actually get the relevant data in that menu? any help would be much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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