Click here to Skip to main content
15,846,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

PHP
<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 7: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

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
<?php include "functions.php"?>
<?php
session_start();
$_SESSION['email'] = $_POST['login_email'];
?>

<?php
if(isset($_POST['login'])){
    LoginUser();
}
?>
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900