Click here to Skip to main content
14,491,616 members
Rate this:
Please Sign up or sign in to vote.
See more:
Just starting to get my head around sessions and I go to write the code and get the error that is the title.

<pre><?php include "functions.php"?>
 <?php session_start(){
        $_SESSION['email'] = $_POST['login_email'];
        
    }
?>

<?php
if(isset($_POST['login'])){

    LoginUser();
   
?>


What I have tried:

Nothing as don't know what to do.
Posted
Updated 26-Jul-19 6:10am
Comments
Richard MacCutchan 26-Jul-19 11:42am
   
"as don't know what to do."
You could start by showing us the actual line of code that causes the error.
[no name] 26-Jul-19 11:45am
   
It's the code in the post.
Richard MacCutchan 26-Jul-19 12:01pm
   
Well, there is a missing close brace character after the call to LoginUser.
Richard Deeming 26-Jul-19 11:42am
   
The error message should include a file name and a line number, which will tell you where to start looking.
[no name] 26-Jul-19 12:02pm
   
It says login.php line 3 which points to this.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Looks like you're missing a semi-colon after your call to session_start[^].

You've also added a new block for no apparent reason, which almost makes the following code look like it's part of a function called session_start, even though it's not.

And as Richard MacCutchan pointed out, you're missing a closing brace after your call to LoginUser.
<?php include "functions.php"?>
<?php
session_start();
$_SESSION['email'] = $_POST['login_email'];
?>

<?php
if(isset($_POST['login'])){
    LoginUser();
}
?>
   
Comments
[no name] 26-Jul-19 12:21pm
   
Thanks a lot man :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100