Hi,
I have create a script that remember variable from a number of html page and then use these in the last page.
The problem I have is when I start the script the first time, I got a warning message when I push the next button.
If I use the back button and than the next button again the problem has disappeared.
Please need help to solve this.
Thanks Niklas
Following warning occur:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /media/disk/php/mpbn70/interface.php on line 5
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /media/disk/php/mpbn70/interface.php on line 13
start page:
<?php
session_start();
if (!empty($_POST)) {
if (!isset($_POST['wizard_finished'])) { // preferably only present on the last step
$_SESSION['_POST'] = array_merge($_SESSION['_POST'], $_POST);
} else {
//wizard finished
$_POST = $_SESSION['_POST'];
//process as if it were one-page request
}
}
# $_POST = array_merge($_SESSION['_POST'] /*stored values*/, $_POST /*post values from the last page*/);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
...
...
...
Next page:
<?php
session_start();
if (!empty($_POST)) {
if (!isset($_POST['wizard_finished'])) { // preferably only present on the last step
$_SESSION['_POST'] = array_merge($_SESSION['_POST'], $_POST);
} else {
//wizard finished
$_POST = $_SESSION['_POST'];
//process as if it were one-page request
}
}
$_POST = array_merge($_SESSION['_POST'] /*stored values*/, $_POST /*post values from the last page*/);
?>