Question

function requiredOk() {
    if (isset($_POST ["NextQuestion"]) && isset($_POST["Question"])) {
        if (!empty($_POST ["NextQuestion"])) {
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}

if (requiredOk()) { // All fields are filled
    if ($_POST ["NextQuestion"] == "Nieuw") {

        setcookie("cookie", $files);
        foreach ($_COOKIE["cookie"] as $vraag) {
             $files = array();
        $files[] = $_POST("Question");
            //$files[] = $vraag;
            //print_r($files);
            print_r("cookie");

        }
    }
}

As you can see I want to store my post variables into an array, which I can use after submission. So when I submit for the first time, I get too see 1 post variable, when I submit for a second time, I want to see 2 post variables in an array and so on.

Was it helpful?

Solution

I suggest making use of PHP Session: http://www.php.net/manual/en/intro.session.php
OR store the array u want to pass along in a hidden textfield usin json_encode and json_decode

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top