Dynamically Adding Form Elements

Dynamically Adding Form Elements

Hi, I'm currently working on as per topic. I've taken the codes from  here.

It works perfectly but I need to add more fields than stated in the post.

If I add in another field, only one field gets the increment. The other doesn't.

Eg.

  1. <form id="myForm" method="get" action="test.php">
  2. <div id="input1" style="margin-bottom:4px;" class="clonedInput">
  3. Name: <input type="text" name="name1">
  4.         Tel: <input type="text" name="tel1">
  5. </div>
  6.     

  7. <div>
  8. <input type="button" id="btnAdd" value="add another name" />
  9. <input type="button" id="btnDel" value="remove name" />
  10. </div>
  11.     <input type="submit" name="submit">
  12. </form>
What I get from the return GET is:  name1=123&tel1=123&name2=123&tel1=123&submit=Submit

The tel does not increase by 1. How do I edit the code to get what I want?

Thanks.