I m sending array table id to get the table no of that table id from database. and i need to add all those table id default seats and return.
JAVA SCRIPT :
function showUser(str)
{
if (str=="")
{
str="";
document.getElementById("table_Merge_comb").value = '';
return;
}
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 && xmlhttp.status==200)
{
document.getElementById("table_Merge_comb").value = xmlhttp.responseText;
}
}
xmlhttp.open("GET","get_tableno.php?table_id="+str,true);
xmlhttp.send();
}
get_table_no.php
<?PHP
include 'config.php';
static $total_default_seats =0;
$item = $_GET['table_id'];
$table_id = explode(",",$item);
$table_count = count($table_id);
for($i=0 ; $i<$table_count; ++$i)
{
$qry = mysql_query("SELECT * FROM table_info WHERE table_id = '$table_id[$i]'");
$row = mysql_fetch_array($qry);
$table_no[$i] = $row['table_no'];
$total_default_seats += $row['default_seats'];
}
echo implode(",",$table_no);
?>
in this code echo implode(",",$table_no); and i get it and store it in textbox by document.getElementById("table_Merge_comb").value = xmlhttp.responseText; now i need to get $total_default_seats this value too