Reputation: 421
I have code
<?php
require_once("lib/functions.php");
$page = new page;
if(isset($_POST['jmeno'])){
$page->mailit($_POST, $_SESSION['result']);
}
$_SESSION['f'] = rand(1,9);
$_SESSION['s'] = rand(1,9);
$_SESSION['result'] = $_SESSION['f'] + $_SESSION['s'];
?>
Before POST
form it prints the right values, but after POST
form the sessions are empty. I don't know why, looks like something is bad configured. So it's always show Bad counted result
Here is session configuration....
Upvotes: 2
Views: 2404
Reputation: 4218
make sure that this line of code:
session_start();
Is at the beggining of your php file, right after the opening php tag <?php
This line of code is used to start new or resume existing session, please see php manual here
Upvotes: 4