Is this even possiable?

INSERT INTO table2 (column1, column2, column3, …)
VALUES ($var1, $var2, $var3,…)
SELECT id,
FROM table1
WHERE id = $var3;

Is this even possible? I want the user to enter his data
from a form. Let him select a organization from a drop down box.
Pass that id to his record. Do a select record of organization
name from that table and then print or use the org name not the org id.
I will store the org id in the user record to retrieve as needed.

Yes and no. Since a user gets logged into your system and therefore has a user ID, you would want to have other things like an organization name as a separate function. You can add a field to your database table and save the organization id there as the user’s default one. But, not in the manner you posted.
You would want to first get the id of the organization from the drop-down. Then, use it to save as needed.
The organization drop-down would include the id of the organization. Then, it can be saved as needed.
Hope that helps…

Yes, it’s possible. Where abouts in the process are you struggling?

Sponsor our Newsletter | Privacy Policy | Terms of Service