I have a form on page5_form.php:
<form action="page6_form.php" method="post">
<input class="chk" id="check1" type="checkbox" name="infoCollectedAndSold[]" value="Identifiers">Identifiers<br>
<input class="chk" type="checkbox" name="infoCollectedAndSold[]" value="Collect">
<input class="chk" type="checkbox" name="infoCollectedAndSold[]" value="Sell">
<input class="chk" id="disclosed" type="checkbox" name="infoCollectedAndSold[]" value="Disclose"><br><br>
<input type="submit" value="Next" />
</form>
The form inputs are stored in session variable like so:
<?php
session_start();
foreach ($_POST as $key => $value) {
$_SESSION[$key] = $value;
}
?>
Then on another page called page6_form.php I display the values chosen from that form:
<?php
session_start();
$arr = $_POST['infoCollectedAndSold'];
foreach ($arr as $key => $val) {
echo '<b>' . $val . '</b>';
}
?>
I then do the same exact thing on page7_form.php:
<?php
session_start();
$arr = $_POST['infoCollectedAndSold'];
foreach ($arr as $key => $val) {
echo '<b>' . $val . '</b>';
}
?>
but get the error message:
Notice: Undefined index: infoCollectedAndSold in C:\xampp\htdocs\legalForm\page7_form.php