PHP simple : PHP tutorial, MySQL tutorial
PHP Tutorial - Free PHP Script

Home | Tutorials | PHP & MySQL Resources | Web Tools
Introduction & Get Start
Using Form
PHP Tags
PHP Variables
PHP Control Structures
Create Database & Table
Database Connection
Insert Record
Select Record
Update Record
Delete Record

Using Form

Using forms in a web based application is very common. Most forms are used to gather information like in a signup form, survey / polling, guestbook, etc.

There are some component in form tag.


A form can have the method set as POST or GET.

  • POST method. This method sends the data from the form within the body of the processing agent. This makes the post method secure and reliable when sending what might be sensitive data from one location to another.

  • GET method. You can get attaches the information to the URL and passes the information in a manner that can be seen by the user so is therefore not a secure method of passing sensitive data. This method also carries a restriction on the amount of data that can be transferred, it is a reasonable amount of data but restricted none the less. This is an example for GET method using by URL

    There are 2 parameters attaching in this URL. Use "?" between real URL and first parameter and use "&" between parameters. Do not use "space" in URL.

    GET method, you can use by form tag by enter "GET" in method component.

When using a form with method="post" you can use $_POST to access the form values. And when the form is using method="get" you can use $_GET to access the values. The $_REQUEST superglobal can be used to to access form values with method="post" and method="get" but it is recommended to use $_POST or $_GET instead so you will know from what method did the values come from.


This component using for specify the name of form when you have more than 1 in 1 page. It useful when programmer do some codes with JAVA Script.


Action component means the target file when you submit the form.


Should you be working in a frameset, this component help you targeting to the right frame when you pass the data.


application/x-www-form-urlencoded. This is used in conjunction with the get method, you cannot send files using this method and it has the security problems we touched on earlier. This would pass the variables in the URL in a manner like the link in example1. In this instance the URL is passing the form variables FirstName and LastName in the URL. As you can see the variables are separated from the URL by a ? and then they are concatenated with the &, this is known as a query string.

multipart/formdata I would typically use this option when setting up an upload facility, using this enctype you can transfer files from our hard drive to your website or other places on the Internet.

You will notice that the enctype list also has a blank option, you can use this option when setting the method to post as you are neither appending info to the URL or trying to upload files to a server.

Export MySQL to Excel
Export MySQL data records to an Excel file in one PHP file, simple and easily!
Real Visitor Counter
This tutorial will show you how to make a simple real visitor counter. It's mean that when someone comes and browse your site or refresh your pages many times. It's still count at 1 (1 person) until he leaves (close his browser).
[email protected]