I’m working on a locally hosted website using HTML, CSS, JS, Flask and SQLite3.
I want to create a functionality where the user is able to share the contents of a table via Email and I’ve created a ‘Share via Email’ button for the same.
When I run the program, the body of the email simply contains – ${inventoryTable} and the content is not displayed.
I know the data isn’t being retrieved correctly. How do I resolve this.
I don’t think I can attach the entire HTML page as its confidential, but the specific line of code I’m talking about is below…
<a href="mailto:?subject=Inventory Table &body=Inventory table details:%0D%0A%0D%0A ${inventoryTable}" target="_blank">Share via Email</a>
This line is supposed to retrieve data from a table wiht ID = “inventoryTable.”
This is what part of inventoryTable looks like –
<table id ="inventoryTable">
<tr style="position: absolute; margin-top: -40px; z-index: 1;">
<th>Product ID</th>
<th>Product Name</th>
<th>Price(₹)/Unit</th>
<th>Quantity Available</th>
<th>Shelf Location</th>
<th>Accept Returns</th>
<th>Reorder Quantity</th>
<th>Edit Item</th>
<th>Delete Item</th>
</tr>
{% for item in data %}
<tr>
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.price}}</td>
<td>{{item.quant_a}}</td>
<td>{{item.shelf}}</td>
<td>{{item.returns}}</td>
<td>{{item.quant_r}}</td>
<td>
I basically want the table headers and the rows to be copied into the email. I think I need to use JS for this but I’m not sure.
Help, please.
P.S. – I’m a 16yr old high-school kid doing this for a real-world client so could really use some help. (Also would really appreciate it if you could explain your solution a tad bit extra).