POST working - not working?


#1

My calling program has an input field with: name=‘userid’ and method =“POST”

At the start of my called program I have: $UserID=$_SESSION[‘userid’]
and I print and get: $UserID on pgm entry = index (that’s correct - comes from the calling program).
Then I have $UserID = $_POST[‘userid’]
and I print and get: $UserID after post = nicky (correct - ID entered by user)

later I link to my database, print and get: $UserID before query = index (HOW IS THIS POSSIBLE?)
Then I do my query which results in ID not found in database and AffectedRows = 0.
Yet, the id is in my database. (print after query is still $UserID = index

How does $UserID get changed back to “index” ??? Baffling!!!

I removed $UserID=$_SESSION[‘userid’] from my calling program and from my called program and I still get $UserID = index (HOW IS THIS POSSIBLE ???) - Even more baffling!!!


#2

I believe I found the answer although I think it shouldn’t work that way.

After I get the user’s entry through my code $UserID=$_POST[‘user’], I have
include(“FTI_Menu.php”); (my menu which appears at the top of my page)

This menu code has $UserID=$_SESSION[‘userid’] at the start and it seems the value it contains which is “index” overrides the $UserID value I get from the POST.

By placing $UserID=$_POST[‘user’] after the include(“FTI_Menu.php”); resolved the problem.

Many thanks. I hope I didn’t waste your time.