Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a form. it has name,age,sex fields. Now there has to be a button , when i click on it, it will add another row, again click then add another. So each row has the same fields name,age,sex. suppose i am saving the family member information to mysql db. then press submit buttton just echo all records to another page... Thanks in advanced folks...
Posted

1 solution

CSS
This solution may be quite tricky or lengthy even, sorry for that but it worked very well in a long run and was  easy to debug to.

Step 1 maintain a hidden textbox
holding the row count of the table you create.
example $ count=count ($ user_listings);

step 2 process each value using for each

Step 3 inside for each on creating table create dynamic id for the textboxes
For ex <input id='<?php echo "listing_header".$iteratedvalue?>'></input>

On submit function

Process it the same way and fetch the values from the $post[dynamic ids]
 Example
<pre lang="vb">&lt;? php $ value =  $ POST ["listing_header". $ iteratedvalue '];?&gt;</pre>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900