Can I post Session id like this?

Hello. I am trying to post the session id of a member to a function. Can I do it like this?

      $m_id = $_POST[$_SESSION['session_member_id']];
      $c_id = $_POST['classidInput'];
      $member_query->addMemberToClass($c_id, $m_id);

At the moment it’s not working. Any idea how I could get this working?
Thanks

The $_POST array should not contain the member's id. If the value is stored in the session array, $m_id = $_SESSION['session_member_id']; would be what you want to do.

EDIT: posting in code because screw autoformatting.

@StarLion Basically I have the function that takes $m_id (the actual id of the member logged in and $c_id (as the class id from the input).
I just wanted to pass the $c_id from the input, and take the $m_id from the actual member that is logged in. What you have posted works for what I need, thanks :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.