Look at line 66 (onChange) and 46($_POST is always empty)
I need to set the $limit variable by using the value from the list in order to limit the no of news shows on the page as per user preference. The default is 10.
[php]
<!-- Add jQuery library -->
<script type="text/javascript" src="jquery-1.10.1.min.js" ></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="jquery.fancybox.css?v=2.1.5" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$('.fancybox').fancybox();
});
</script>
<style type="text/css">
table {
font-size:<?php $cookie_color=$_COOKIE["fsize"];echo $cookie_color;?>px;
font-family:Arial;
}
<?php
$cookie_color=$_COOKIE["color"];
$cookie_fsize=$_COOKIE["fsize"];
//echo $cookie_color;
//echo $cookie_fsize;
$url = "http://siu.edu.in/downloads/all-announcements.php";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($curl);
curl_close($curl);
$DOM = new DOMDocument;
libxml_use_internal_errors(true);
$DOM->loadHTML( $output);
//----------------------------
mysql_connect("*", "*", "*") or die(mysql_error());
mysql_select_db("unify14") or die(mysql_error());
$limit=10;
if(!empty($_POST)) //Always Comes Back as empty...so $limit is never set
{
$limit = $_POST['limit'];
}
$limit2=$limit/2;
//---------------------------
$divs2 = $DOM->getElementsByTagName('div');
$data = mysql_query("SELECT * FROM content_anirudh where category='SICSR' limit ".$limit2."")
or die(mysql_error());
echo "
BACK
![]() |
Symbiosis International University |
SIU News Headlines |
Results Per Page:
Current:".$limit."
10
20
50
100
|
";
$count2=0;
while($info = mysql_fetch_array( $data ))
{
Print "
".$info['heading'] . " |
";
$count2++;
}
$count=1-($limit2-$count2++);
foreach($divs2 as $div2)
{
if($div2->getAttribute('class')=='menu_body4'||$div2->getAttribute('class')=='menu_body5')
{
$divs = $div2->getElementsByTagName('a');
foreach($divs as $div)
{
if($count <= $limit2)
{
$count++;
if(strpos($div->getAttribute('href'), 'http://') !== 0)
{
echo "".$div->nodeValue." |
";
}
else
{
echo "".$div->nodeValue." |
";
}
}
else
break;
}
}
}
echo "
";
?>
[/php]