Need to set $_POST by using onChange

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
Contact Us
Symbiosis International University
"; $count2=0; while($info = mysql_fetch_array( $data )) { Print ""; $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 ""; } else { echo ""; } } else break; } } } echo "
SIU News Headlines
Results Per Page: Current:".$limit." 10 20 50 100
".$info['heading'] . "
".$div->nodeValue."
".$div->nodeValue."
"; ?>

[/php]

1 add the name limit to use it, PHP uses name not id.
2 $_POST should never be empty unless no other data is being passed, you are using the post array as opposed to a specific thing in the post array.

I edited your post to remove your sql connection details

First thing, you are using deprecated code. You need to use PDO or mysqli. I have provided a download of a complete working PDO database.

http://www.phphelp.com/forum/the-occasional-tutorial/beginners-pdo-bumpstart-code-use-it-now!

The reason you are not getting your data posted is because your select does not have a name.

Wrong:
[php] [/php]

Right

Sponsor our Newsletter | Privacy Policy | Terms of Service