PHP Form Part-1


 

PHP Form Part-1

In this tutorial, we will learn how to deal with Html Form, JavaScript Validation, MySQL Database and PHP Scripts. We divided this tutorial into several parts, so we can explain you one by one.

In this tutorial, we will learn how to deal with Html Form, JavaScript Validation, MySQL Database and PHP Scripts. We divided this tutorial into several parts, so we can explain you one by one.

Topic : HTML FORM

Part - 1

 In this tutorial, we will learn how to deal with Html Form, JavaScript Validation, MySQL Database and PHP Scripts. We divided this tutorial into several parts, so we can explain you one by one.

Let's start with Html Form :

If you have little bit  knowledge about Html, then you can understand that form tags are used to take information of the users. A form tag includes number of fields such as text boxes, radio buttons, check boxes, drop down lists, text areas, and submit buttons. We will try to cover all these fields in our form.

Let's take a look in basic Html Form called Login Page :  

<html>

<head>

<title>Login Page</title>

</head>

<body>

<form action="dislay.php" method="post">

Username : <input type="text" name="userid" value="" size="30" /><br/><br/>

Password : <input type="password" name="pass" value="" size="30" /><br/><br/>

<input type="submit" name="submit" value="Submit" />

</form>

</body>

</html>

If you noticed that above code is indicating about Html Form. It starts with <html> ends with </html> and in between html tags we used <head> and <body> tags.  In the head tag we mentioned the title called Login Page in between <title> tags.

The main part of the Html form starts from the Body tag. In the <body> tag we have taken  <form> tag and within form tag <input> tags. So, create the form above. Save your form called basic_form.php. Start your server, and make sure the form loads ok in your browser. You should be able to see a text box, password text box and a Submit button.

Now, come to the point, why we make this form?. This form is used to know that how many users you have and their information. Let's take an example : If any user visit to your site and wants to login, then you will need to get his detail through textboxes. After getting the detail that the user provided then you can tested through your database.

In the next part, we will discuss about method used in form.

Ads