fahim74 Posted May 13, 2013 Share Posted May 13, 2013 I have been practicing mysql and then i have came accross a issu that i can't solve ... i have also asked in different forum and dont find any suitable ans ..... so here i am ... I am making a large form that will be able to store information from user in the database .. I have managed to make and store data from simple form fields like Name, Country , Age , Interest and etc using mysql and php ... I have a table called users in my database which have approximate 15 column for different data like Name , Country , Age etc .... Now I have added this from field to my from and confused about how to store data from this field .. here is the img of my form .... the above table says.....each separate user will have separate employment histroy which will be submitted through row 1-4 and Employer's Name , Country , Position etc (4 row of them) will go in columns called emp_name , emp_country, emp_pos etc. . Even if i create a different table ex - emp_history then how to store data from this form for each user ? than you for understanding ... Quote Link to comment https://forums.phpfreaks.com/topic/277944-problem-storing-data-from-this-form-fileds/ Share on other sites More sharing options...
Love2c0de Posted May 13, 2013 Share Posted May 13, 2013 Can you post your form code? Kind regards, L2c. Quote Link to comment https://forums.phpfreaks.com/topic/277944-problem-storing-data-from-this-form-fileds/#findComment-1429806 Share on other sites More sharing options...
ginerjm Posted May 15, 2013 Share Posted May 15, 2013 This sounds like a lack of understanding of database structure and normalized data. Add a table to hold this employment history - you will have multiple records for each employee. Be sure to have a common field between the Employee table and the EmpHist table so that you can link them together in your queries. As for processing the input form that has your html table on it, each column's <input> tag will have a name attribute on it such as 'name="ename[]"' and 'name="ecountry[]"' and 'name="efrom"' in the html and your php code will retrieve this data as an array - $ename = $_POST['ename'] which would create a php array called $ename. Do this for each input element name and then loop thru them all to collect each complete row of employment data and post each to your database. Quote Link to comment https://forums.phpfreaks.com/topic/277944-problem-storing-data-from-this-form-fileds/#findComment-1430218 Share on other sites More sharing options...
Q695 Posted May 15, 2013 Share Posted May 15, 2013 loop the whole row line retrieval code through a while statement. Quote Link to comment https://forums.phpfreaks.com/topic/277944-problem-storing-data-from-this-form-fileds/#findComment-1430279 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.