Code Example

1 First we have to create a web form with fields called name, age and email address. We also need to create a button to submit the form and finally tell the form where to post to. In this case, we are posting the form back to this page.

 

2 Now we use LiveCode script to print the results out on to the screen. All the data posted by the form is stored in the $_POST[] array.

 

FORM PROCESSING
Process Data Submitted by a Form

A common task in web development is to collect and process data submitted through forms on a webpage. You could be collecting email addresses from potential customers or just providing a way for people to get in touch without having to open their mail client. In the following example we will try to collect the persons name, age and email address.

When a form is submitted, the data is passed in the $_POST variable which is an array. The name of each of the form elements below become the keys of the array, with the corresponding values being the data entered by the users.

Name
Age
Email Address
 

 

Dynamic Result (Posted Data)

Name:
Age:
Email: