Storing data from web forms

Asked By 0 points N/A Posted on -

How do I use MYSQL to store data that has been collected in a webpage form?

Best Answer by Sharath Reddy
Answered By 0 points N/A #90346

Storing data from web forms


You can make your data store in web forms and storing it in database, it is the most common web development tasks. For this kind of work you have to do something like these options.

First of all create a MYSQL Database which will connect to the web server. Also create a Database table, enter your product entities and store in a separate MYSQL. Then please build an HTML5 form. This will help you in supporting files and libraries that you have already loaded.

After this, process the Form data connecting to the Database. For details see this link.

Best Answer
Best Answer
Answered By 561675 points N/A #90347

Storing data from web forms


Using MySQL to store data is easy because it usually comes free whenever you signup for an account in any web hosting service. Allowing a web form to be available in a website gives different methods of storing data that are submitted by different users.

For you to create a database you need first to construct a MySQL table. You also need to plan first for the structure of your MySQL table to have an idea on what information you should be collecting like for example: first name, last name, age, gender, city, especially date the form submitted.

To construct the table, click the SQL table and then enter the information based on the criteria above using standard SQL query or command:

CREATE TABLE form_data(
        id integer NOT NULL AUTO_INCREMENT,
        first_name VARCHAR(255),
        last_name VARCHAR(255),
        gender VARCHAR(10),
        age INTEGER,
        city VARCHAR(255),
        submit_date DATE,
        PRIMARY KEY(id));

After this click Go. Your “form_data” MySQL table will then be created. Next is to create an interface where the visitors will submit their data. Below is an example of the basic form:

Next to do is to create a server-side script that will store the form data to MySQL. See the example below:

To understand better visit here.

Login/Register to Answer

Related Questions