PHP
<form action="page5_form.php" method="post" name= "test">
<ul>
<li>
<input name='arr[<?php echo $i?>][service]' type='checkbox' data-id='Incometax'value="<?php echo $service['service_id']?>"/><?php echo $service['servicename']?>
<ol>
<li>
<?php foreach ($activities as $activity) : ?>
<input type='checkbox' name='arr[<?php echo $i?>][activity][]' value="<?php echo $activity['id']?>" /><?php echo $activity['nameofactivity'];?>
</li>
<li>
<?php foreach ($pers as $per) : ?>
<input type='checkbox' name='arr[<?php echo $i?>][timeperiod][]' value="<?php echo $per['periodicity_id'];?>" /><?php echo $per['per_time'];?>
</li>
<br>
<?php endforeach;?>
<br>
<?php endforeach;?>
<br>
</ol>
</li>
</ul>
<?php
$i++;
endforeach;?>
<input name="number" type="hidden" value="<?php echo $next; ?>">
<input type="submit" name="submit" value="Submit"/>
</form>
我的php代码的输出是:-
在此输出中
我存储此服务时,我的存储代码为
foreach($_POST['arr'] as $input)
{
$service = $input['service'];
echo $service;
echo "<br>";
foreach($input['activity'] as $act)
{
$query2 = "insert into serviceactmap(service_id,activity_id)values('$service','$act')";
foreach($input['timeperiod'] as $per)
{
$query3 = "insert into mapactivityperodicity(activity_id,perodicity_id)values('$act','$period')";
}
}
}
谢谢你