Hello Progrramres! I am once again back to you with a new blog post which describe 'How to create a Multi-Row Data Form' with HTML and Java Script and in the coming post I will also describe that how to feed the data with this form in the database with PHP.

Multi-Row data forms are very use full when you are working with Database programs. Let us suppose that we need to create an Invoice Form for a Retail shop where we have to select multi products at a time to create the Bills or Invoices. In this case we need a multi-row data form.

Before starting I would to tell you that you must have the knowledge of HTML and Java Script. So if you are familiar with JS then it might be lot easier to understand the JS script.

Even if you are not enough with Java Script, you can also create the same on your computer just because I have placed the ready to use codes in below snippets.

Now lets Start, you can see HTML code below. Only you have to do what, only create an HTML file with name 'index.html'. Copy below code and paste into 'index.html' file and save it.

HTML Code Section

<!DOCTYPE html>
<html lang = "en-US" ?xml version = "1.0">
<title>Multi-Row Data Form</title>
<link rel = 'stylesheet' href = 'css/style.css' type = 'text/css'/>
<script src = 'js/v2.0.2jquery.min.js'></script>
<script src = 'js/script.js'></script>
<h1>Multi-Row Data Form</h1>
<p>Click '+' button to Add New Rows.</p>
<p>Click '-' button to Delete the same Row.</p>

<form action  = "" method = "post" id = "frm_data">
 <th><input type = "button" value = "+" id = "addnew" title = "Click to Add New Row"/></th>
<tbody id = "tbl_body">
 <td><input type = "text" placeholder = "Input-1"/></td>
 <td><input type = "text" placeholder = "Input-2"/></td>
 <td><input type = "text" placeholder = "Input-3"/></td>
 <td><input type = "text" placeholder = "Input-4"/></td>
 <td title = "This Row Can't be Deleted"></td>
<input type = "button" value = "Submit" id = "sub_button" title = "Save the Record"/>

Now lets move on CSS. Create a folder named 'style' in the same directory where you have created  'index.html'. Inside 'style' folder create a file named 'style.css' and paste the below codes into it and save.

CSS Code Section

<style> // Remove the style tags while pasting this code into '.css' file

#frm_data th,tr,td {
#frm_data th{

Note: Remove the <style> tags when you are pasting this code into '.css' files and then save it.

Now it's time to create Java Script file. To do this first create a folder named 'js' where you have created  'index.html'. Inside 'js' folder create a file named 'script.js' and paste below code into it and save.

JS Code Section

 $('body').delegate('#del_row', 'click', function(){
 function addnewrow(){
  var n = ($('#tbl_body tr').length - 0) + 1;
  var row =  '<tr>' +
     '<td>' + n + '</td>' +
     '<td><input type = "text" placeholder = "Input-1"/></td>' +
     '<td><input type = "text" placeholder = "Input-2"/></td>' +
     '<td><input type = "text" placeholder = "Input-3"/></td>' +
     '<td><input type = "text" placeholder = "Input-4"/></td>' +
     '<td><input type = "button" value = "-" id = "del_row" title = "Click to Delete this Row"></td>' +


The most important thing is click on the below link to download and unzip the Java Script file for JQuery Function. Place this file into 'JS' folder.

Download Java Script File

Now when you click the '+' button on the form, a new form row will be added and when you click '-' then that row will be deleted.
In next post we will learn 'How to submit data with this form in PHP and SQL.

Thanks a lot
Chandan Kumar Vishwakarma


How to submit the multiple rows form data with a single submit in PHP

Related Topics



Hello friends! Progrramers is a tutorial site of w3 programming. If you like this tutorial site please encourages us by sharing this site links with your friends and nears & dears who want to learn web development and give us like on our Facebook page. If have any question please type in to comment box or send us message on social media sites via below given social links. Thank you, have a nice learning.

Post A Comment:


  1. download link is not working.

    1. Google Shortner is expired therefore it is not working...please download the codes from jquery site.

  2. Either the drive can be conveyed to our office situated in Bangalore or it very well may be gotten and dropped to customer's and client's area (Currently accessible assistance in Lab recuperation in Bangalore area) or individual visit to our office area, other city or nation is upheld by means of dispatch office.data hdd recovery