If you look at the query below I cannot insert this query as the error it is returning is :
undefined variable:
error in C:\wamp64\www\course selector\senthil\insert_data.php on line 25
And my code is:
<?php
require_once("connectdb.php");
$name = $_POST["name"];
$email = $_POST["email"];
$contact = $_POST["contact"];
$country = $_POST["country"];
$state = $_POST["state"];
// $Areaofstudy = $_POST["Areaofstudy"];
$course = $_POST["course"];
$institutes = $_POST["checkbox"];
if(isset($_POST['submit']))
{
for ($i=0; $i<sizeof($institutes); $i++)
{
// $query ="INSERT INTO `enquiries` (`name`, `email`, `contact`, `country`, `state`, `area_of_study`, `course`, `institute`) VALUES ('" . $name ."', '" . $email . "', '" . $contact . "', '" . $country . "', '" . $state . "', '" . $Areaofstudy . "', '11', '" . $institutes . "')";
$query = "INSERT INTO `enquiries` (`name`, `email`, `contact`, `country`, `state`, `area_of_study`, `course`, `institute`) VALUES ('" . $name ."', '" . $email . "', '" . $contact . "', '" . $country . "', '" . $_POST['Areaofstudy'] . "', '" . $_POST['course'] . "', '16', '17')";
$result = $dbhandle->query($query) or die($error) ;
}
}
?>