I have seen that there are similar questions, but they do not seem to be helping...could just be that I am not understanding correctly and able to translate their examples to my needs. Any help is appreciated.
I am trying to convert an input field on a $_POST form to my users table, specifically on the managers key, from the managers name (in the form), to the managers id (in the DB). Let me show an example.
Our DB has (among other tables) a users table and a managers name. The managers table just has the manager's id, first & last name. The users table has their own id, first_name, last_name, and associated manager id. This is how it looks:
id first_name last_name
1 John Doe
2 Mary Lewis
id first_name last_name manager
1 Steve Thompson 1
After you managed to parse the managers name and split it to first and last name you can just select the managers
id in a subselect
update USERS set first_name = :user_first_name last_name = :user_last_name manager = ( select id from MANAGERS where first_name = :manager_first_name and last_name = :manager_last_name ) where id = :user_id
However i would probably use a drop down selection with the managers
id as value. You still can display his first and last name.