I have a php code that goes as:
<head>
<form><input type="hidden" id="hiddencontainer" name="hiddencontainer" value="1000" />
<script language="JavaScript">
var wrapper, content, test, myhidden;
myhidden = document.getElementById("hiddencontainer");
myhidden.value=1000;
var more = '<div style="height:100%; background:#e6f2ff;"><?php
$minId=$_REQUEST['hiddencontainer']; //(1)
//echo $minId; //(2)
$queryPost="select *
from userpostdec
where postid<".$minId." limit 50;";
$rows=pg_query($queryPost);
while($row=pg_fetch_array($rows)){
echo $row['content'];?><br><?php
}
?></div>';
// this is the scroll event handler
function scroller(){
if(wrapper.scrollTop + wrapper.offsetHeight + 1000 > content.offsetHeight){
content.innerHTML += more;
myhidden.value -= 50;
}
}
</script>
</form>
</head>
I'm using it for infinite scroll, and very time new data is added, I want my variable $minId
to be decreased by 50. For that, I use JS (the complete script is not shown since everything else is working perfectly fine). My entire problem is in line 1 and 2. Apparently, it's not getting assigned (probably) because when I hard code $minId
to be 1000 and don't change it at all, every load just works fine, but now the infinite scroll isn't working. Please help me figure it out. Thanks.