Jump to content

duplicate form help


MDanz

Recommended Posts

i have a form that i'd like to duplicate on the press of a button?

 

 echo "<form enctype='multipart/form-data' action='rapidinsert.php' method='post' name='changer'>
         <br /><br />
	  <font color='#D99C29' face='Arial' size='3px'>Add Noun </font><input type='text' name='noun' value='' size='30' />       <input type='submit'  value='Submit' style='font-size:10px' />
	  
	  
	  <input type='submit'  value='Add form' style='font-size:10px' />
	  
	  </form>";

 

 

How do i duplicate this form every time i press Add form button?

 

So it lists multiple forms.

Link to comment
Share on other sites

i tried this but it's not working.

 

<?php


	   echo "<form enctype='multipart/form-data' action='rapidinsert.php' method='post' id='Add'>
         <br /><br />
	  <font color='#D99C29' face='Arial' size='3px'>Add Noun </font><input type='text' name='noun' value='' size='30' />       <input type='submit'  value='Submit' style='font-size:10px' />
	  
	  

	  <div onclick='Addform()'>Add Form</div>
	  </form>";

	?>

 

<script type="text/javascript">
function Addform(){
var container = document.getElementById('Add');
var newfield = document.createElement('input');
newfield.type = 'text';
newfield.id = someCounter+'_suffix';
container.appendChild(newfield);

}
</script>

Link to comment
Share on other sites

You do realize that dynamically adding/duplicating a form on a page would serve no clear useful purpose because you can only fill in and submit one form on a page. If you had the original plus two dynamically produced duplicates, you can only fill in one of them and submit it, you might as well just fill in the first one that was already there and not bother with the dynamically produced ones.

 

However, if you are trying to dynamically add fields to a form, that makes sense and there are countless examples posted all over the Internet.

 

Which are you trying to do?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.