How to Create a Form in HTML & Have Results in a Text File

Save

Web developers often use HTML forms to gather information from visitors. For example, web visitors might complete an HTML form in order to request more information about a service, sign up for a newsletter or register for an event. HTML forms once included "mailto" scripts that simply emailed the form submission to a designated email address. However, developers now commonly write scripts to transfer form submission data to dedicated databases in order to protect company email addresses and make the process of retrieving and using form data more efficient. If you use a reporting device like Business Objects, you can easily retrieve your form data from your database in a text file or a variety of other formats.

  • Create a script that will transfer the data from your form submissions to a dedicated database. Ensure that you correctly map the fields you intend to include on your form (first name, last name, etc.) to columns in your database. Host the script on your web server and make note of the URL, as you will need to include this in the "action" command for your HTML form.

  • Create an HTML form on your website. Edit your webpage code to include the HTML code for your form in the location that you want the form to appear on the page. Begin your form with the "<form>" tag, and end it with the "</form>" tag. Designate your script name from step 1 as the "action" of your form. Use the "input" command to create an input field for each piece of data that you wish to capture in your HTML form. Create a button to submit your form with an input field that has a type, name and value of "submit."

  • Check in your updated code to your website. As an example, your basic form code might look like:

    <form method="post" action="yourscriptname">
    <input type="text" size="10" name="first">
    <input type="text" size="10" name="email">
    <input type="submit" name="submit" value="submit">

  • Test your form to ensure that it works as expected. Access your database using a reporting tool like Business Objects. Use Business Objects Desktop Intelligence to create a report that returns the data collected on your form during any time period you specify. Run the report and view the results. Export your data by opening the "Data" menu and selecting "View Data." When the "Data Manager" window appears, click the "Export" button. Choose the text format, such as .CSV or .TXT, that you wish to use for your text file. Give the file a name and save it in a location you will remember.

References

  • Photo Credit submit button image by creative from Fotolia.com
Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Are You Really Getting A Deal From Discount Stores?

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!