Jquery Duplicate Fields Form Submit with PHP

How to submit jquery duplicate/clone field values to form with PHP. It’s very basic level code, I had implemented this using relCopy.js jquery plugin to duplicating the existing field. I hope it’s useful for you. Thanks!

Perfect Javascript Form Validation using Regular Expressions
Jquery Validation with Regular Expressions
Server Side Form Validation using Regular Expressions

Javascript and HTML Code
Here input text name hobby[] is array.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="reCopy.js"></script>
<script type="text/javascript">
  var removeLink = ' <a class="remove" href="#" onclick="$(this).parent().slideUp(function(){ $(this).remove() }); return false">remove</a>';
$('a.add').relCopy({ append: removeLink});	

<form method="post" action="">
  <p class="clone">
    <input type="text" name="hobby[]" class='input'/>
  <p><a href="#" class="add" rel=".clone">Add More</a></p>
  <input type="submit" value="Submit" name="submit" />

Contains simple PHP Code that extracting array hobby[] values.

if(isset($_POST['submit'])) {
  foreach($array as $hobby)
      echo '<h3>'.$hobby.'<h3/>';


body {
  font-family:Verdana, Arial, Helvetica, sans-serif;
.remove {
.input {
  border: solid 1px #006699;
Please follow and like us:

By Rodney

I’m Rodney D Clary, a web developer. If you want to start a project and do a quick launch,I am available for freelance work.

One thought on “Jquery Duplicate Fields Form Submit with PHP

Leave a Reply

Your email address will not be published. Required fields are marked *