Skip to content

Instantly share code, notes, and snippets.

@pbanigo
Created Jun 20, 2022
Embed
What would you like to do?
Update form with EJS variables
<!-- add header -->
<%- include('includes/_header') %>
<!-- end header -->
<!-- Main section -->
<main id="main">
<a href="/">
<span class="text-gradient"> All Drugs</span>
</a>
<h2>Edit <%= drug.name %></h2>
<span>Use the below form to edit a drug</span>
<!-- Update drug form -->
<form method="POST" id="update_drug">
<div class="new_drug">
<div class="form-group">
<label for="name" class="text-light">Drug Name</label>
<input type="hidden" name="id" value="<%= drug._id %>">
<input type="text" name="name" value="<%= drug.name %>" placeholder="Drug Name">
</div>
<div class="form-group">
<label for="card" class="text-light">Tablets per Card</label>
<input type="number" name="card" value="<%= drug.card %>" placeholder="Tablets per Card" min="1" max="500">
</div>
<div class="form-group">
<label for="pack" class="text-light">Tablets per Pack</label>
<input type="number" name="pack" value="<%= drug.pack %>" placeholder="Tablets per Pack" min="1" max="500">
</div>
<div class="form-group">
<label for="perDay" class="text-light">Taken per day</label>
<input type="number" name="perDay" value="<%= drug.perDay %>" placeholder="Taken per day" min="1" max="500">
</div>
<div class="form-group">
<button type="submit">Edit Drug</button>
</div>
</div>
</form>
</main>
<!-- End main section -->
<!-- add footer -->
<%- include('includes/_footer') %>
<!-- end footer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment