Is it possible to open another PHP file (print_array.php) passing $array via PHP function?
HTML:
<form method=post>
<input type="checkbox" name="array[]" value="111">
<input type="checkbox" name="array[]" value="222">
<input type="checkbox" name="array[]" value="333">
<button type="submit" name="action" value="print">Print</button>
<button type="submit" name="action" value="delete">Delete</button>
<button type="submit" name="action" value="add">Add New</button>
</form>
array[] is all checked, so, $array value is 111, 222, and 333.
Then, PHP function:
switch ($action) {
case 'print': printing($_post['array']); break; /* open new window */
case 'add': break; /* same window */
case 'delete': break; /* same window */
default: break;
}
function printing($array) {
/* open print_array.php in a new window showing $array value */
}
And then, only if action=print, open print_array.php in a new window with $array value.
if (is_array($array)) {
print_r($array);
} else {
...
}
The result in print_array.php would be
Array ( [0] => 111 [1] => 222 [2] => 333 )
I don't think header("Location: print_array.php") can pass array value. Is there any good way to open another PHP page in a new window passing array value?