Validating data in php form

In order to access your form fields in code, you need to assign names to the form and each of the fields. For more information see, NAME Attribute | name Property.

You may assign any name you want that is composed of alphanumeric characters (without spaces), but to make writing the code easiest, you should provide a useful, friendly name for each of the fields.

You need a custom function that you can later connect to the form.

In this table, Element refers to the name of the HTML element for the form field, Type refers to the value of the type attribute for the form field, and Label refers to the text to the left of the form field. Form code updated with name attribute values Now that you have assigned names for the form and form fields, you are ready to start writing the script that handles the validation for the fields. If you are typing the Java Script code in this article manually and receive errors, you should check that all casing is the same as shown in this article.

Otherwise, you may want to review JScript Run-Time and Syntax errors.

A function is a piece of code that consists of one or more lines of script.

A function can take arguments and can return values.

Because the code is stored within the page or within a linked file, it is downloaded into the browser when a user accesses the page and, therefore, doesn't require a roundtrip to the server.

For this reason, client form validation can be faster than server-side validation.

Lisa Wollin Microsoft Corporation May 2004 Applies to: Microsoft® Office Front Page® 2003 Microsoft Front Page 2002 Microsoft Front Page 2000 Summary: Learn how validate HTML form fields using Java Script in Microsoft Office Front Page 2003.

This article assumes a general understanding of HTML and Java Script.

The action attribute tells the browser what to do when a user submits the form.


  1. While most swinging is about two couples sharing fun and swapping partners, many swingers regularly participate in threesomes.

  2. Live is the sister site and latest version of the popular sex cam site Live Jasmin.

  3. He never went into detail about the nature of this second channel when he started it, but it was used as a secondary channel in the same way many You Tubers utilized secondary channels at the time; as a platform for additional content, as well as to maximize on the earning power of his audience via advertisements.

  4. The violation was a failure to report travel plans as required and social media postings that resulted in death threats to the judge, Assistant District Attorney (ADA) and probation officer assigned his case.

  5. While some would want to take it slow, others would also want to get to the point quickly – it really depends upon the situation.

  6. According to Livy (History of Rome, 5.6), if a war was not over by the end of summer, “our soldiers must wait through the winter.” He also mentioned a curious way that many soldiers chose to spend the time during the long waiting: “The pleasure of hunting carries men off through snow and frost to the mountains and the woods.” The first recorded continuation of war into the winter by the Romans took place in 396 BC during the siege of the Etruscan city of Veii. It involved the beating or stoning to death of every 10th man within the army unit where mutiny took place.

Comments are closed.