Click on a button and add row to a table
Click a button or text link and add new row to a table and the best part is you can easily retrieve these values on any form submitted webpage.
This is just another tip to make your form more interactive.
One application that I can remember is yahoomail, while attaching files. If we have more than 5 files to be attached then there is an add button you just click there and add rows of files, so the same thing here.
Demo
Click here to view the demo.
Code
In the body tag
In the head tag
Source of this script is http://www.mredkj.com/tutorials/tableaddrow.html
Just one minute don’t go……. There is one last thing left
How would you retrieve the values of these input boxes on the page the form is submitted to?
if(isset($_POST["txtRow$i"])) {
$txtRow=$_POST["txtRow$i"];
$dhRow=$_POST["dhRow$i"];
}
where $txtrow is the first row inputbox and $dhrow the second row input box (check the code to get a better picture)