Urgent help needed ......Add dynamic table on button click

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
snehathomas184
Forum Newbie
Posts: 7
Joined: Tue May 27, 2014 3:40 am

Urgent help needed ......Add dynamic table on button click

Post by snehathomas184 »

i need same table again when clicking ADD Button...but here when i insert some value in first table and click add button, generate th value inserted table again...i need empty table(all time.ie,after putting value in 1sttable also)

And how to insert all these tables data to database

<script language="javascript" type="text/javascript">
function Add(id){
var table=document.getElementById(id);
var clone=table.getElementsByTagName('TBODY')[0].cloneNode(true);
table.appendChild(clone);
counter++;
}


</script>
<table border="0" id="tst">
<tr>
<td>Facility Name
<label>
<input type="text" name="o_f" id="o_f" size="27"/>
</label></td>
</tr>
<tr>
<td>Address<label>
<textarea name="o_add" id="o_add" cols="23" style="margin-left:36px; margin-top:0px;"></textarea>
</label></td>
</tr>
<tr>
<td>City <label>
<input type="text" name="o_city" id="o_city" size="27" style="margin-left:63px;margin-top:-16px;"/>
</label></td>
</tr>
</table>
<input type="submit" name="button" id="button" value="ADD"><input type="button" value="Add" onclick="Add('tst');"/>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Urgent help needed ......Add dynamic table on button cli

Post by Celauran »

Duplicate of viewtopic.php?f=13&t=139706. One topic per question is enough.
Locked