I have a table that features 5 columns that are entered into a database, there are 3 rows of these
How would I build a table in the database that stores these, if they complete just one row it adds just that one, if they complete all three it adds all three. Then I need to populate these fields if they come back to the page if they have completed them.
Would I create a database like
id | userid | this | that | other | another | last
(userid is the link between this table and the user table)
and loop through to create multiple rows? How would I add this to the database using php?
Thanks
Code:
<form method='post'>
<table>
<tr>
<td><textarea name='this'></textarea></td>
<td><textarea name='that'></textarea></td>
<td><textarea name='other'></textarea></td>
<td><textarea name='another'></textarea></td>
<td><textarea name='last'></textarea></td>
</tr>
<tr>
<td><textarea name='this2'></textarea></td>
<td><textarea name='that2'></textarea></td>
<td><textarea name='other2'></textarea></td>
<td><textarea name='another2'></textarea></td>
<td><textarea name='last2'></textarea></td>
</tr>
<tr>
<td><textarea name='this3'></textarea></td>
<td><textarea name='that3'></textarea></td>
<td><textarea name='other3'></textarea></td>
<td><textarea name='another3'></textarea></td>
<td><textarea name='last3'></textarea></td>
</tr>
<tr>
<td colspan='5'><input type='submit' value='submit' /></td>
</tr>
</table>
</form>
How would I build a table in the database that stores these, if they complete just one row it adds just that one, if they complete all three it adds all three. Then I need to populate these fields if they come back to the page if they have completed them.
Would I create a database like
id | userid | this | that | other | another | last
(userid is the link between this table and the user table)
and loop through to create multiple rows? How would I add this to the database using php?
Thanks