Merry Christmas all.
I have a question about isset and methods.
I want some variables to be written to a session variable when a button is clicked. I can set variables to the session variable just fine, but problems occur once I use set methods inside the if statement for 'isset'.
I imagine this is because the whole script executes, and adds all the data to the session variables, then when the button is clicked the session variables have already been defined and so the new data does not get added, is that right?
<?php
if (isset($_POST['submit'])) {
// this does not work
$_SESSION['myTest']->setAnswer("set inside if");
}
// this does work
$_SESSION['myTest']->setAnswer("set outside if");
?>
Cross post here