nitation Posted July 12, 2008 Share Posted July 12, 2008 Good day Gurus. I have an admin area where i add an amount. What i wanna achieve is, i wanna select a user_id from table x and insert it to table y for a specific user. Note: the specific user's ID is retrieved from table x in a drop down menu. How do i get the user_id from table x and insert it to table y since my drop down menu will list all the user's in the table. That means my user's sessions is not applicable here since am in the admin area. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/114469-solved-how-to-retrieve-from-table-x-to-table-y/ Share on other sites More sharing options...
ratcateme Posted July 12, 2008 Share Posted July 12, 2008 i am kinda confused but i think this is what you want if you have a drop down menu like this <select name="user_id"> <option value="1">john</option> some php loop through table_x <select> then have a sql query like this INSERT INTO `table_y` (`user_id`) VALUES ('{$_POST['user_id']}'); Scott. Link to comment https://forums.phpfreaks.com/topic/114469-solved-how-to-retrieve-from-table-x-to-table-y/#findComment-588606 Share on other sites More sharing options...
nitation Posted July 12, 2008 Author Share Posted July 12, 2008 Thanks for ur reply, The problem is i don't want to select the userid from a drop down menu. I want it to automatically insert after the submit button. Note: I am processing my form on the same page. regards Link to comment https://forums.phpfreaks.com/topic/114469-solved-how-to-retrieve-from-table-x-to-table-y/#findComment-588609 Share on other sites More sharing options...
Barand Posted July 12, 2008 Share Posted July 12, 2008 Note: the specific user's ID is retrieved from table x in a drop down menu. The problem is i don't want to select the userid from a drop down menu. ??? what exactly do you want? ??? what are your table structures? ??? what exactly should be inserted from one table into the other? Link to comment https://forums.phpfreaks.com/topic/114469-solved-how-to-retrieve-from-table-x-to-table-y/#findComment-588647 Share on other sites More sharing options...
nitation Posted July 13, 2008 Author Share Posted July 13, 2008 I observed my question was a bit complicated. But i managed to figure it out. Thanks for your help guys Link to comment https://forums.phpfreaks.com/topic/114469-solved-how-to-retrieve-from-table-x-to-table-y/#findComment-588907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.