Jump to content

Problem storing data from this form fileds


fahim74

Recommended Posts

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 ....

 

temp.jpg

 

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 ...

 

 

 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.