Hi guys,

I'm currently encountered this weird foreach() error,
Code:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: controllers/admin.php
Line Number: 391
And these are the codes that has an error,
Code:
			//Process lesson check boxes
			if(isset($_POST['submitlesson'])) {
				if(isset($_POST['boxlesson'])) {
					foreach ($_POST['boxlesson'] as $id){ //This is the error line codes, Line Number: 391
						echo 'lesson: '. $id .'<br>';
					}
				}
These are the source of the variable $boxlesson,
Code:
					<?php
						//Display lessons records
						if(!empty($vdata_lessons)) {
					    	foreach($vdata_lessons as $data) { 
						    	//$data['lessonid'] $data['namelesson']
						    	$lesson_url = 'admin/cp_proc/' . $data['lessonid'] . '/lesson/';
								$lesson_edit_url = 'admin/edit_lessons/' . $data['lessonid'];
					?>
								<input type="checkbox" name="boxlesson" value="<?php echo $data['lessonid']; ?>">
						    	<a href="#">
						    	<?php
						    		echo $data['namelesson']. ' ';
						    	?>
								</a>
		        				<a href="<?php echo site_url($lesson_edit_url); ?>">
		        					<img src="<?php echo base_url('img/icon_edit.png'); ?>" alt="Edit record" height="20" width="20">
		        				</a>&nbsp;<br>
					<?php
					    	}
						}
					?>
Actually the $_POST['boxlesson'] is just a variable name from textboxes inside a form (see above codes).
What I'm missing?


Thanks in advance.