-4

i'm creating a project. but in my system the php session is get lost after redirect to another page. the session is sometimes work. but suddenly doesn't work. i can't catch the problem.please help me.

In index.php page code is: i have session started on this page. (https://i.stack.imgur.com/hR7oP.jpg)

In login.php code is (it's dynamic loads in index page): (https://i.stack.imgur.com/vqfiA.jpg)

to redirect member_index.php page code is: (https://i.stack.imgur.com/WpBeW.jpg)

please help me.

Here you can see my project: moneytradebd.com

  • Please don't add your code as screenshots but paste it as formatted code here. – nkr Dec 11 '18 at 08:50
  • 1
    @nkr, normally I would agree with that but I don't know if I would have spotted the error if I hadn't seen the extra spaces before `session_start()` was called – tshimkus Dec 11 '18 at 09:44

1 Answers1

1

You can't have any whitespace or carriage returns before calling session_start(). Starting your php code on line 3 on your index.php and member_index.php files is the problem. Start it on line 1 and it should work fine.

tshimkus
  • 1,173
  • 2
  • 17
  • 24