jQuery Duplicate Fields Form Submit with PHP

Few days ago I am searching for jQuery plugin to use in my up coming HTML website and I found this great plugin on how to duplicate fields in just few line of codes and I want to share this with you.

In this article you will know on how to duplicate fields using .relCOpy jQuery plugin, you don’t need to study and take time to read any javascript tutorials just for nothing, here you can follow this step by step easily.


Here input text name[] is an array

rel=”.clone” is the class name of the field to clone or copy.

Javascript Code

$(‘a.name’) is the class name of Add Name button.

Copy Limit

To limit how many fields to copy (e.g. 4 and a total of 5 fields) just edit the anchor above code to this

For more Information on relCOpy jQuery Plugin :relCopy

PHP Code

I am using foreach PHP function to extract name[] array

Enjoy ^_^, share your idea below.

by Ryan Sutana

  • Guzz

    Hi, how would you add a second input to the form and mak it also be written in the DB?

  • @Guzz based on my example above you can add a second input field once you click on Add Name anchor and to store data to DB you can use serialize() PHP function and unserialize() it to view HTML form.

    or you want to add 2 fields every time you add a field?

  • arasa

    Excellent but… how can i do the same with the select box? Thanks

  • I love your wonderful article. awesome stuff. I hope you release many. I will carry on subscribing

  • we imagine you rarely quit! It is among the finest websites I’ve ever read. You need certain loony competency below, man. Freezing desire that you never eliminate your lifestyle considering that you are one with the greatest blog owners to be found. Why not carry on because the world wide web demands you getting the news out.

  • AstegeAlopsk

    SunCloud Tailwind sunglasses come with a microfiber storage bag that doubles as a lens cleaning cloth.

  • AstegeAlopsk

    If you remember the 2008 game you know that the turning back of time was replaced by having the Elika character magically save you every time you screwed up a jump.
    Discount Mulberry Bags

  • Howdy, i read your weblog occasionally and i own a comparable one and i was just wondering in the event you get plenty of spam comments? If so how do you avoid it, any plugin or anything you’ll be able to advise? I get so considerably lately it’s driving me mad so any assistance is extremely much appreciated.

  • Great work! This is the type of information that should be shared around the web. Shame on Google for not positioning this post higher! Come on over and visit my web site . Thanks =)
    go to my site

  • Sindhu Chinchu

    can u implement this using drop down list..or please tell me how to get values from cloned drop down list..
    my scenario is i cloned drop down list along with input text box after on submit button pressed i need each value from drop down list along with text box value please help me