I want to store related activities of services
<form method='post' id='userform' action='arrayvalue.php'> <tr>
<td>Trouble Type</td>
<br>
<td>
<input type='checkbox' name='servicevar[]' value='tds'>tds<br> <br>
<input type='checkbox' name='activityvar[]' value='One'>Return<br>
<input type='checkbox' name='activityvar[]' value='Two'>Filling<br>
<br>
<input type='checkbox' name='servicevar[]' value='Gst'>Gst<br> <br>
<td>
<input type='checkbox' name='activityvar[]' value='One'>Return<br>
<input type='checkbox' name='activityvar[]' value='Two'>Filling<br>
<br>
</td> </tr> </table> <input type='submit' name="submit" class='buttons'>
<?php if(isset($_POST[submit]) {
$activity = $_POST['activityvar'];
$service = $_POST['servicevar'];
foreach ($service as $key => $value) {
echo ($value);
echo "<br>";
foreach ($activity as $key => $value) {
echo ($value);
echo "<br>";
}
}
}
MY OUTPUT:
-
tds
- one
- two
- one
- two
-
Gst
- one
- two
- one
- two
Expected Output:
- tds
- one
- two
- Gst
- one
- two
Thanksss...
Aucun commentaire:
Enregistrer un commentaire