Giter Club home page Giter Club logo

form-storage's Introduction

Formspree for dummies

Single-file proof-of-concept for a self-hosted Formspree alternative. Can be used to accept all incoming POST calls and store them in an sqlite database file. Useful for forms on static sites.

NOT safe, do NOT use this as-is. For this to be really useful you'd have to make the form keys unique, and enforce usage of each key by only 1 user/domain. Right now everyone can write to any key with any content/fields.

Example:

<form action="https://yourserver.com/someRandomKey" method="post">
    <label for="email">Your Email</label>
    <input name="email" id="email" type="email">
    <label for="message">Message</label>
    <textarea name="message" id="message"></textarea>
    <input type="hidden" name="_redirect" value="https://yourstaticsite.com/thanks.html" />
    <!-- a very basic honeypot for spam prevention -->
    <input type="text" name="_dry" style="display:none !important" tabindex="-1" autocomplete="false" />
    <button type="submit">Submit</button>
</form>

Submitting this form will create a new entry in the sqlite database on your server for key "someRandomKey" and the entire POST body (email and message) as a JSON encoded string. You can then query this data and handle it as you please (mail it to someone, export it as a CSV, send it to Google Spreadsheets, etc..).

form-storage's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.