I’ve got a dynamic html table and I want to retrieve the data from that table using the POST method. Is it possible to do this? What other ways would you recommend to achieve this.
Here’s a simple example from what I got:
<html>
<form id="form1" method="post" action="process.php">
<table id="tblSample" name="tblSample">
<tbody>
<tr>
<td>
John Appleseed
</td>
<td>
Australia
</td>
</tr>
<tr>
<td>
Mary Poppins
</td>
<td>
USA
</td>
<tr>
</tbody>
</table>
</form>
</html>
Maybe it’s possible to store the info in a javascript array or variable in order to post it to the action file, I’m not sure.
I don’t know if this has anything to do, but the table is generated dynamically. The rows and cells are added by the user using javascript.
I’d appreciate your answers very much.
A table cannot be accessed as such, unless you use form elements (
input,textarea, etc.) and addnameattribute to them; then, you can access your elements with$_POST.If you have your data in a table, the best way to retrieve our data is by JavaScript, using
innerHTML.