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
https://forums.phpfreaks.com/topic/208979-duplicate-form-help/
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
https://forums.phpfreaks.com/topic/208979-duplicate-form-help/#findComment-1091721
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
https://forums.phpfreaks.com/topic/208979-duplicate-form-help/#findComment-1091732
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.