$_SESSION['username']/hidden value
<?php
session start();
?>
<?php echo $_SESSION['username']; ?>,
Please submit this form to book a project room in the Business School.
I've been trying to print out the $_SESSION['username']
on my form. But nothing gets printed. I've passed the session start();
on all necessary files but it still doesn't work. Please do advise.
I've tried开发者_运维问答 using hidden value also, but it doesn't work. :/
Use session_start();
instead of session start();
.
Add var_dump($_SESSION);
after the session_start() to your script, for debugging.
Try: echo isset( $_SESSION['username'] );
OR my favourite: print_r( $_SESSION );
and see everything in the session
I got the same problem. The problem exist when you create a variable like
$username
Maybe your $username is empty. I don't know why this is happening.
$username and $_SESSION['username'] are supposed to be not equal or interchangeably.
See the examples below
$_SESSION['token'] will change and be equal to $token if you have $token variable
I tried to copy the same code I have to the other hosting and that works fine. So I conclude that the issue belongs to your hosting.
精彩评论