Invalid argument supplied for foreach(),no proper solution found
I am trying to send checkbox values using ajax jquery to other php page i tried to check if i am getting the value using alert and i got what i wanted, but on passing it to other page using "data:" i am getting error on the other page where i am using that passed checkbox (array) to save in database. Error is
" : Invalid argument supplied for foreach() on line 10
second page code :
> <?php
>
> include_once('connect.php');
>
> $name=$_REQUEST['name'];
>
> $query="INSERT INTO `students`(`studentid`, `name`, `doa`,
> `contactno`, `contactno2`, `mailid`,
> `profession`,`reference`,`fprof`,`mprof`,`address`) VALUES
> ('','".$name."','".$_REQUEST['doa']."','".$_REQUEST['contact1']."','".$_REQUEST['contact2']."','".$_REQUEST['email']."','".$_REQUEST['prof']."','".$_REQUEST['ref']."','".$_REQUEST['fprof']."','".$_REQUEST['mprof']."','".$_REQUEST['add']."')";
>
> mysqli_query($conn,$query) or die(mysqli_error());
>
> $last_id=mysqli_insert_id($conn);
>
> $select=array();
>
> $select=$_REQUEST['course'];
>
> foreach($select as $value)
> {
> $query2="insert into class(studentid,courseid) values(".$last_id.",".$value.")";
> $q=mysqli_query($conn,$query2) or die(mysqli_error());
> }
> ?>
foreach($select as $value) is the error here
链接地址: http://www.djcxy.com/p/53066.html