How can I pass the variable from php to my javascript so it a unique number autoincrementing. I think have the wrong format. Any help with would be appreciated. I am trying to get "txtHint" + autoincrementing $i to go to javasript as unique id. So it will work in the loop. How can I pass it so java can translate it correctly with php as txtHint+$i. I cannot get it to bring any results. Any help much appreciated..
<script type="text/javascript">
function showCustomer(str)
{
var xmlhttp;
if (str=="")
{
document.getElementById("txtHint"+$i).innerHTML="";
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("txtHint"+$i).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","somepage.php?q="+str,true);
xmlhttp.send();
}
</script>
$result=mysql_query("SELECT * from items");
echo "<table >
</tr>";
for ($i = 0; $Update = mysql_fetch_assoc($result); ++$i)
{
<td><input type='text' size='5' id='cno' name='cno' value='{$Update['line']}'
readonly/></td>
<td><input type='text'size='5' name='con' value='{$Update['con']}' readonly/>
<td><select name='Description' id= 'cfname' onchange='showCustomer(this.value);
<td width='20'><div id='txtHint".$i."' ></div></span></td>