my problem is that the value in array "Session name" can't be insert into table.Into the array of 'session name[]' value cannot insert into the table row.the code is as given below.please help me to solve my problem.
if(isset($_POST['submit']))
{
if(isset($_POST['type']))
{
$prid=clean($_POST['type']);
}
if(isset($_POST['Introduction']))
{
$Introduction=clean($_POST['Introduction']);
}
if(is_array($_POST['Sessionname']))
{
$Sessionname=$_POST['Sessionname'];
$sscount=count($Sessionname);
}
if(is_array($_POST['duration']))
{
$duration=$_POST['duration'];
$durcount=count($duration);
}
for($i = 0;$i<=$durcount; $i++)
{
if($i==0)
{
$sql="INSERT INTO packages(prid,session_name,duration) VALUES
(
'$prid',
'$Introduction',
'$duration[$i]'
)";
}
else if($i>0)
{
$j=$i-1;
for($j = 0;$j<=$sscount; $j++)
{
$sql="INSERT INTO packages(prid,session_name,duration) VALUES
(
'$prid',
'$Sessionname[$j]',
'$duration[$i]'
)";
i want output in my table is like below :
pkid prid session_name duration
1 1 Introduction Session 15 minutes
2 1 Session2 45 minutes
3 1 Session3 30 minutes
4 1 Session4 5 minutes