So, when I run this code on xampp, it works and I can see the variables, without the header.



$result=mysqli_query($con,"SELECT * FROM passwords WHERE userid='$id' AND password='$password'");
$rresult=mysqli_query($rcon,"SELECT * FROM registration WHERE userid='$id'");

$eresult=mysqli_query($econ,"SELECT email FROM emaillist WHERE userid='$id'");

When I add the header, I get:

Notice: Undefined index: loginid in C:\xampp\htdocs\website\session\session.php on line 12

Notice: Undefined index: password in C:\xampp\htdocs\website\session\session.php on line 13

Why does it work without the header but not with the header?

Recommended Answers

All 4 Replies

session_start() needs to be before any variable declarations/html. Try putting


at the top of the page, and delete your line 16.

No, sorry. It didn't fix it.

Alright, it works on my live site but not on XAMPP. Must be an XAMPP problem.

Ahh ok, this seems like one of those cases where with all the "*AMP" localhost servers, it could just be a matter of setting specific permissions and allowing certain mods to be run on your localhost

Don't forget to mark this thread solved if you got what you need :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.