Undefined Offset error PHP

fiedierceib

New Member
Having an interesting problem with a piece of legacy web application I am working on, I keep getting the following error:\[code\]Notice: Undefined offset:\[/code\] 0,1,2,3, etc etcI have a jQuery tablesorter that sorts the data based on user input. This error only occurs for results that are on page 2+.So if I go to update the results on page 1, everything is fine, I do not get the above Offset Error. However,any page other than 2 throws me that above offset error.The following is the php code that is generating the error:\[code\]if(count($_POST)>0) { if ($_POST['action'] == "update"){ // find out how many records there are to update $size = count($_POST['review_id']); // start a loop in order to update each record $i = 0; while ($i < $size) { // define each variable $approved = $_POST['approved'][$i]; $banned = $_POST['banned'][$i]; $review_id = $_POST['review_id'][$i]; //var_dump($approved); //var_dump($banned); //var_dump($review_id); if (isset($_POST['delete'][$i])){ $delete = 1; } else { $delete = 0; }\[/code\]The $approved, $banned and $review_id are the ones that cause the errors. The \[code\]var_dump\[/code\] seems to output the string when the results are on page. however, on any pages greater than one all the \[code\]var_dump\[/code\] outputs is NULL NULL NULL respectively. I have checked with Firebug and all the select forms are named appropriately \[code\]<select name="approved[4]" id="select2">\[/code\] even the ones on page 2 \[code\]<select name="approved[79]" id="select2">\[/code\]Any help would be much appreciated. EDIT: If I change the amount of rows delivered to page one it works fine. By that I mean: If I let PHP display 50 rows on the first page as opposed to the 25 currently, it updates correctly. So any amount of results on page 1 updates fine, any results that may flow over to page 2 and beyond - do not!.
 
Back
Top