i feel dumb (like always)
So i have website, and finally trying to move what i build on localhost to my website but the hell that's not working somehow. Finally after research what i get is my session is not working.
So i try make simple php session on my website and it's somehow the session variable not setting like i want.
This is the example i try :
http://dofaiyah.com/shop/login/ << access this, when clcik submit, i make $_SESSION["token"] = "green" and then redirect to index (http://dofaiyah.com/shop/index.php) and echo that session.
But that's not working.
My code is very simple
On Login
<?php
session_start();
if ( isset( $_POST['submit'] ) ) {
$_SESSION["token"] = "green";
header("Location: ../index.php");
//echo $_SESSION["token"];
}
?>
<html>
<body>
<form action="" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
On index
<?php
session_start();
if(!isset($_SESSION['token'])){
//header("Location: login");
}
else {
$_SESSION['views'] = 1;}
echo "views = ". $_SESSION['token'];
?>
Like what i'm missing? i really don't know.
//////
Edit : yes i'm already try to excecute it at my localhost and it's working perfectly.