Skip to content

Instantly share code, notes, and snippets.

@sushant12
Created June 2, 2017 09:11
Show Gist options
  • Save sushant12/278f66caa554933f295484f19496e40e to your computer and use it in GitHub Desktop.
Save sushant12/278f66caa554933f295484f19496e40e to your computer and use it in GitHub Desktop.
fetching data for edit form
<% DB.execute(“select rowid, * from tasks where rowid = #{id}”) do |row| %>
<form method=”post” action=”/update?id=<%= row[0]%>”>
Task Name: <input type=”text” name=”task” value=”<%= row[1] %>”>
Finished?: <input type=”checkbox” name=”finished” value=”1" <% if(row[2] == 1) %> checked <% end%>>
<input type=”submit” value=”Update” >
</form>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment