hardikspider123 Posted October 8, 2015 Share Posted October 8, 2015 Hi I want to create an application. Main form contain other form(one to many relationship) for example if I insert record for one employee which can have multiple phone numbers.so I should be able to insert multiple phone numbers for one employee. so can you give me hint that how should I create this scenario. I have developed form already but don't know from where start coding. I am new to php,jquery,ajax,html Please guide me. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 8, 2015 Share Posted October 8, 2015 Here is your guidance, go to http://www.w3schools.com/ and study the tutorials. If you get stuck on something we will be happy to help when we see what you have attempted. Your not quite ready for us. Quote Link to comment Share on other sites More sharing options...
hardikspider123 Posted October 8, 2015 Author Share Posted October 8, 2015 Thanks for making fun Quote Link to comment Share on other sites More sharing options...
Barand Posted October 8, 2015 Share Posted October 8, 2015 Main form contain other form(one to many relationship) You can't nest forms. Your data tables will be 1 to many though, an employee table and a phone table, each row of which contains employee id and a phone number. Just have one form containing employee fields and multiple fields for phone number entry. Name the phone fields something like "phone[]" so they are posted in an array, which you can loop through to process. When processing, insert the employee data and grab the last_insert_id to get the value of the new auto_incremented id field. Use this to insert the emp id value in each of the phone number records. Quote Link to comment Share on other sites More sharing options...
hardikspider123 Posted October 15, 2015 Author Share Posted October 15, 2015 Thank you very much that helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.