I followed the guide on w3schools but I can't manage to make the script return the data I want when I choose a user from the dropdown menu. I just get undefined index: userdrop Here is the script (changed the GET with POST, maybe that's what I messed up)
<script>
function UserInfo(str) {
    if (str == "") {
        document.getElementById("txtHint").innerHTML = "";
        return;
    } else {
        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 (this.readyState == 4 && this.status == 200) {
                document.getElementById("txtHint").innerHTML = this.responseText;
            }
        };
        xmlhttp.open("POST","testing.php",true);
        xmlhttp.send();
    }
}
</script>
The dropdown menu:
<form>
<select name="userdrop" onchange="UserInfo(this.value)">
  <option value="">Select a person:</option>
  <option value="1">Peter Griffin</option>
  <option value="2">Lois Griffin</option>
  <option value="3">Joseph Swanson</option>
  <option value="4">Glenn Quagmire</option>
  </select>
</form>
<br>
<div id="txtHint"><b>Person info will be listed here...</b></div>
And the php code which doesn't provide me with any results due to undefined index
$row = $MMM->Users(intval($_POST['userdrop']));
echo "<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>City</th>
</tr>
<tr>
<td>".$row['user_id']."</td>
<td>".$row['user_name']."</td>
<td>".$row['user_city']."</td>
</tr>
</table>
";
 
     
    