<% if (onerec === null) { %>
    <h1>No Record Found</h1>
<% } else { %>
    <h1>Edit Product</h1>
    <form action="/product/save" method="post">
        <input type="hidden" name="product_id" value="<%= onerec.product_id %>" >
        <table>
            <tr> <td> Product Name: </td> <td> <input type="text" name="productname" value="<%= onerec.productname %>" required> </td> </tr>
            <tr> <td> Image: </td> <td> <input type="text" name="prodimage" value="<%= onerec.prodimage %>" required> </td> </tr>
            <tr> <td> Description: </td> <td> <textarea name="description" rows="10" cols="30"><%= onerec.description %></textarea> </td> </tr>
            <tr> <td> Price: </td> <td> <input type="text" name="saleprice" value="<%= onerec.saleprice %>" required> </td> </tr>
            <tr> <td> Homepage: </td> <td>
                <% if (onerec.homepage) { %>
                    <input type="checkbox" name="homepage" checked>
                <% } else { %>
                    <input type="checkbox" name="homepage">
                <% } %>
            </td> </tr>
            <tr> <td> Stock: </td> <td> <input type="number" name="stock" value="<%= onerec.stock %>" required> </td> </tr>
        </table>
        <button type="submit">Save</button>
    </form>
<% } %>