I'm developing a basic ERP in PHP for a small firm, they need to maintain accounts of 2 separate companies within it. Working in Code Igniter as I am most familiar with that framework. I need to allow the user to be logged in on both companies at the same time accross tabs, how can I ensure that while saving data from one form it only posts to that company's records? I'm using only one db, with 2 users - hence user_id will be the foreign key in all tables. I need to ensure that when saving an invoice of one company it doesnt take the other company's user_id, which may happen if i use sessions. Would the best approach be to use hidden user_id fields on all forms? Or is there any other method I can use for this?
Thanks :)