Weird foreach() error?

Hi guys,

I’m currently encountered this weird foreach() error,

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,

			//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,

						//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="#">
						    		echo $data['namelesson']. ' ';
		        				<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">

Actually the $_POST[‘boxlesson’] is just a variable name from textboxes inside a form (see above codes).
What I’m missing?

Thanks in advance.

Okay I found the bug,

I modify the variable name.

from this,


to this,


Problem solved!

by myself again. lol