Hello everyone first of all I have done a lot of research in the forum and other pages during these whole weekend before finally giving up and posting it.
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>El primer script</title>
</head>
<body>
<div id="wrapper">
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<p>numero: <input type="text" name="number" /></p>
<p><input type="submit" value="start" /></p>
</form>
</div>
<?php
if(!isset($_SESSION['CREATED'])) {
session_start();
$_SESSION['aux'] = 1;
} else {
$_SESSION['aux'] = 0;
}
if(isset($_SESSION['CREATED'])){
var_dump($_SESSION['aux']);
}
?>
</body>
</html>
What I want to accomplish is that when I press the button (doesn’t matter if input is empty or not) it shows the number 1 but if I press again doesn't matter how many times it shows 0.
It is not working, it always shows 1, I don't think i managed to make the session work at all.
I might have mistaken the functionality of something rather than making a syntax error. I am beginning with php so if anyone can help if would be appreciated.