Hello, Friends I need help inserting in database using array.
I have create a table having 3 columns and 4 rows. When the user clicks on insert row one more row will be added in the table form. How to insert the values in the database which is filled up in the form? This form will be available for every student after they login. I think i need to use array for it. But dont know how to do it. Here is my code
<html>
<head>
<script type="text/javascript">
function insRow()
{
var w=document.getElementById('myTable').insertRow(5);
var x=w.insertCell(0);
var y=w.insertCell(1);
var z=w.insertCell(2);
x.innerHTML='<select name="local4"><option VALUE="">--Select--<option VALUE="Local">Local<option VALUE="Central">Central</select>';
y.innerHTML='<textarea rows="4" cols="25"></textarea>';
z.innerHTML='<textarea rows="4" cols="25"></textarea>';
}
</script>
</head><br><br>
<body><br>
<table id="myTable" align="center" cellpadding="4" cellspacing="0" border="1">
<tr>
<td valign="top">Local/Central</td>
<td>Duties</td>
<td>Skill Set</td>
</tr>
<tr>
<td valign="top">
<select name="local4">
<option VALUE="">--Select--
<option VALUE="Local">Local
<option VALUE="Central">Central
</select></td>
<td><textarea rows="4" cols="25"></textarea></td>
<td><textarea rows="4" cols="25"></textarea></td>
</tr>
<tr>
<td valign="top">
<select name="local4">
<option VALUE="">--Select--
<option VALUE="Local">Local
<option VALUE="Central">Central
</select></td>
<td><textarea rows="4" cols="25"></textarea></td>
<td><textarea rows="4" cols="25"></textarea></td>
</tr>
<tr>
<td valign="top">
<select name="local4">
<option VALUE="">--Select--
<option VALUE="Local">Local
<option VALUE="Central">Central
</select></td>
<td><textarea rows="4" cols="25"></textarea></td>
<td><textarea rows="4" cols="25"></textarea></td>
</tr>
<tr>
<td valign="top">
<select name="local4">
<option VALUE="">--Select--
<option VALUE="Local">Local
<option VALUE="Central">Central
</select></td>
<td><textarea rows="4" cols="25"></textarea></td>
<td><textarea rows="4" cols="25"></textarea></td>
</tr><tr>
<td valign="top" colspan="3" align="center">
<input type="button" onclick="insRow()" value="Insert row">
<input type="Submit" name="Submit" value="Save">
<input type="Submit" name="Submit" value="Submit" >
</td>
</tr>
</table>
<br />
</body>
</html>
Please let me know asap.