DEV Community

TJ-MD
TJ-MD

Posted on

Tutorial: How to Write Web Form Data to MySQL Databases

Want to try out a simpler way to write your form data to your own systems? This tutorial uses WayScript, a new developer friendly platform we are building. Check it out for free on our website.

Introduction

Data collection forms work well in theory. You send a form out, gather data, and that data is written to some applications storage for you to retrieve it. What if you need to write form data to your own systems? WayScript provides a way for you to create forms, gather data, and write them to your own internal storage systems and databases. Whether these are Airtable bases, Google Sheets, or SQL based databases, we make it easy. In this tutorial, let's take a look at how we can create web forms, and connect them to your own database.

Creating your Web Form

To create a web form which can be accessed at it's own url, we can use a form trigger to provide us this. We're able to customize the questions, selections, and more. This will be the head of our workflow.

Form Trigger

We're able to customize the form's questions with the settings on the left. In this example, let's set up just a few questions. Let's say we're making an employee workplace accident form:
Example Form

We could add as many fields and customization as we would like here. This form will be accessable at the provided url. If you would like to fill out the form we're making making in this example, you can find it here.

Writing our Form Data to a Database

Once we collect the form data, it will be available to us on WayScript to process it as we want. To connect a database and write to it, we need to drag in an SQL module under our form trigger.

Form Trigger

After placing this module, we'll just need a little bit of code to write to the connected database:

Form Trigger

And just like that, we're writing form data to your database! Of course, the possibilities with WayScript are limitless and we could do more processing on this data. But hopefully this shows you how to start writing data to your own database with WayScript!

Top comments (0)