In an AJAX tutorial I found I modified it to query a database. The problem is I don't know how to get multiple responses to print. Here is my js and php code:
JS CODE
function createRequestObject(){
var request_;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_ = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_ = new XMLHttpRequest();
}
return request_;
}
var http = createRequestObject();
function getInfo(){
http.open('post', 'test.php');
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.send('id='+ document.form_select.select_select.selectedIndex);
http.onreadystatechange = handleInfo;
}
function handleInfo(){
if(http.readyState == 1){
document.getElementById('my_div').innerHTML = 'Loading...';
}
if(http.readyState == 4){
var response = http.responseText; <------here is where I need multiple responses from the PHP page
document.getElementById('my_div').innerHTML = response;
}
}
$ id = $_POST['id']
{
RUN SQL QUERY on $ID
Echo row results on user information
$name=$row['name'];
city=$row['city'];
etc etc...
}
else
{
echo 'Username does not exist';
}
I need to be able to print all the user's info.