post multiple different ratings - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: post multiple different ratings (/showthread.php?tid=40520) |
post multiple different ratings - El Forum - 04-11-2011 [eluser]tim peterson[/eluser] hi all, I'm having a heck of a time figuring out how to post multiple ratings for different items, this code let's me rate multiple items, but not single items: <b> for($i=0;$i<2; $i++) { $doc_item_id=$_POST['item_id0'][$i]; $doc_rating=$_POST['document_rating'][$i] ; $it_rt = array( 'item_id'=> $doc_item_id, 'rating' => $doc_rating, ); $this->purchases_model->update_document($it_rt); } </b> whereas this code let's me rate only the first item: <b> foreach($_POST['item_id0'] as $doc_item_id) { foreach($_POST['document_rating'] as $doc_rating) { } break; } $it_rt = array( 'item_id'=> $doc_item_id, 'rating' => $doc_rating, ); $this->purchases_model->update_document($it_rt); </b> any thoughts on how to correct either of these would be greatly appreciated, thank you, tim post multiple different ratings - El Forum - 04-13-2011 [eluser]adamfairholm[/eluser] Can you give us an idea of what you are trying to accomplish outside of these functions? |