Hello Friends,

I have a very simple table which contains 5 rows having 4 columns.

The columns are label, Dropdown menu, Texbox, Textarea respectively

Suppose the student enters 2 rows than it shuld go in the datbase like

id | student_id | local/central | duties | skills
--------------------------------------
1 | 1 | local | duties1 | skills1
2 | 1 | central | duties2 | skills2

And if the user doesn't enter the last 2 or 3 rows it shuld not go in the database..So basically I dont know how to insert multiple entries.

Here is my code

<html>
<table width="40%" align="left" cellpadding="4" cellspacing="0">
<tr>
<th valign="top" align="left">Unit</th>
<th valign="top">Local/Central</th>
<th valign="top">Duties</th>
<th>Skill Set</th>
</tr>
<tr>
<td valign="top" width="4%">1</td>
<td valign="top" width="3%"><select>
<option value="volvo">Local</option>
<option value="saab">Central</option></select></td>
<td valign="top" width="3%"><input type="text"></td>
<td width="10%"><textarea rows="5" cols="30"> 
</textarea></td>
</tr>

<tr>
<td valign="top" width="4%">2</td>
<td valign="top" width="3%"><select>
<option value="volvo">Local</option>
<option value="saab">Central</option></select></td>
<td valign="top" width="3%"><input type="text"></td>
<td width="10%"><textarea rows="5" cols="30"> 
</textarea></td>
</tr>

<tr>
<td valign="top" width="4%">3</td>
<td valign="top" width="3%"><select>
<option value="volvo">Local</option>
<option value="saab">Central</option></select></td>
<td valign="top" width="3%"><input type="text"></td>
<td width="10%"><textarea rows="5" cols="30"> 
</textarea></td>
</tr>

<tr>
<td valign="top" width="4%">4</td>
<td valign="top" width="3%"><select>
<option value="volvo">Local</option>
<option value="saab">Central</option></select></td>
<td valign="top" width="3%"><input type="text"></td>
<td width="10%"><textarea rows="5" cols="30"> 
</textarea></td>
</tr>

<tr>
<td valign="top" width="4%">5</td>
<td valign="top" width="3%"><select>
<option value="volvo">Local</option>
<option value="saab">Central</option></select></td>
<td valign="top" width="3%"><input type="text"></td>
<td width="10%"><textarea rows="5" cols="30"> 
</textarea></td>
</tr>
<tr>
<td valign="top" colspan="4"><input type="Submit" name="Submit" value="Save" onClick="javascript:subit(1);"></td>
</tr>
</table>


</html>

well you can use a if else statment to test which thing happened and then make it insert from there

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.