So I've been working on a web project using PHP and I'm having trouble with assigning session variables in my forms. I'm not sure what I'm doing wrong, so I was hoping someone here could help me out.
Here's the code I'm currently working with:
// In my form page
$_SESSION['username'] = $_POST['username'];
After submitting the form, I expected the `$_SESSION['username']` variable to hold the value entered by the user, but it seems to be empty. I've already made sure that the `session_start()` function is called before assigning any session variables.
Am I missing something here? Is there a different way to assign session variables in PHP?
Any help or suggestions would be greatly appreciated. Thanks in advance!