<html>
<head script type="javascript/text">
<script>
function validate()
{
var html=document.getElementById(<?php '$count1'?>);
<?php
session_start();
$_SESSION['fuserid']=?>="html"
}
</script>
</head>
</html>
<?php
session_start();
$database="myfriend";
$userid=$_SESSION['user'];
mysql_connect("127.0.0.1","root","");
$db_found=mysql_select_db($database);
$sql="select fuserid from friends where userid='$userid';";
$result=mysql_query($sql);
$count1=0;
while($db_field=mysql_fetch_assoc($result))
{
?>
<body>
<a href="displayprofile.php" id=<?php =$count1; ?> onclick="validate(this)">
<?php print $db_field['fuserid']."<br>";
?>
</a>
</body>
<?php
$count1=$count1+1;
}
mysql_close();
?>
according to $db_field the displayprofile.php will chenge but whenever i am trying to use this code i am getting last $db_field variable ??can any one help to solve this problem.