Friday, April 5, 2019

PHP Forms

A Simple HTML Form

<html>

<body>

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

Name: <input type="text" name="name 1"><br>

E-mail: <input type="text" name="mail id"><br>

<input type="submit">

</form>

</body>

</html>

What is Form?

Form are classified into many types like registration form.login form,request form,contact us form etc.A form is submitting your data to the server.Form is getting the input from the user.

PHP $_POST

PHP post is used to collect PHP Course in Chennai the form data after submission of form in post method

PHP $_GET

PHP $_GET can also be used to collect form data after submission of form in the get method.

HOW GET Method Works?

1.Get method is used to PHP Certification in chennai get the input data from the user
2.we can also bookmark the Get method after the submission of form.
3.Get method is use only String data type because the values are visible in the url.
4.It has high performance compared to POST.
5.the length of the values can be exceeded over 255 characters.

How POST Method Works?

1.the process of POST method is happened after the submission of input data.
2.the post method process are invisible to users.
3.the Post method will submit the data to the url
4.we can’t bookmark PHP Training Institutes the submitted values.
5.the post method use many data types they are string,numeric and binary etc.

Attribute in Form:

Action attribute:the action attribute will specifies the url that will process the data
Method attribute:the method attribute will specify the submitted type.

The Form uses HTML tags and the form tag is <form>...</form> and it also include input
Box,check box and radio button.

The form are used to collect the PHP Training Institute in Chennai input of user and the check box are used to tick the relevant
field and the radio button are used to mark the relevant field.Form can be written in both php
and html tag,

Using Best PHP Course in Chennai is the easiest way to write the code for form.with the help of get and post method only,The form action is performed.

Form Validation

Text Fields

The name 1, mail id and website fields are text input elements, and the comment field is a textarea. The HTML code looks like this:
Name: <input type="text" name="name 1">
E-mail: <input type="text" name="mail id">
Website: <input type="text" name="website">
Comment: <textarea name="msg" rows="2" cols="60"></textarea>

Radio Buttons

The gender fields are radio buttons Best PHP Training Institutes and the HTML code looks like this:
Gender:
<input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="male">Male
<input type="radio" name="gender" value="other">Other

The Form Element

The HTML code of the form looks like this:
<form method="post" action="<?php echohtmlspecialchars($_SERVER["PHP_SELF"]);?>">
When the form is submitted successfully, the form data is sent to method="post".


the $_SERVER["PHP_SELF"] sends the submitted form data to the submitted page, instead of going to another page.

No comments:

Post a Comment