Important Notice:

Course Content
Heading Tag / Paragraph Tag
0/2
Horizontal Rules (HR element)
0/1
Font Element
0/1
Image Element
0/1
HTML Basic (Chapter 3) M2-R5.1
About Lesson

There are different attributes of the form tag

  1. Action attribute
  2. Method attribute
  3. Target Attribute

Action attribute:-

                इस attribute से आप यह define कर सकते है कि form submit होने के बाद क्या होना चाहिए। जैसे form submit करते ही आप thank you का message show कर सकते है या php की कोई script execute कर सकते है।

<form action=“some.php”>

Method Attribute

इस attribute के द्वारा data store किया जाता है यानी data किस method से होकर जाएगी इस attribute मे define किया जाता है और method attribute मे केवल 2 ही values पास किया जाता है। GET या POST

  • GET (default)
  • POST

Note:- get value में response के तौर पर पूरा URL दिखाई देता है जबकि पोस्ट में URL दिखाई नहीं देता है।

<form action=“some.php” method = “POST”>

Target Attribute

इस attribute का use तब होता है जब form submit होता है। अर्थात form submit होने के बाद कौन सा page open होगा। इसे हम target attribute मे define करते है।

_self :- The result will be displayed in same tab. It is default value.

_blank :- in new tab

_top :- in the entire browser window i.e. “breaks out of all frames”.

_parent :- in the parent of the current frame.

Example: <form target=”_blank”>

 

There are different attributes of the form tag

  1. Action attribute
  2. Method attribute
  3. Target Attribute

Action attribute:-

     It specifies the program or script that accepts the contents of the form for processing. If this attribute is absent, the base URL of the form is automatically used.

<form action=“some.php”>

 Method Attribute

It Specifies how to send the form data to a web server. The data can be sent as URL variables, by using the get method or as HTTP post, by using the post method.

  • GET (default)
  • POST

GET

GET sends the data as part of the URL.

It is default value. It is not secure method because the submitted form’s data will be visible in the address field of the browser.

<form action=“some.php” method = “GET”>

POST

HTTP POST requests supply additional data from the client (browser) to the server in the message body.

We must use post method when form contains sensitive or personal information because it does not display the submitted form data in the address field of the browser.

<form action=“some.php” method = “POST”>

Target Attribute

It specifies where to open result after submitting the form. It can have value:

_self :- The result will be displayed in same tab. It is default value.

_blank :- in new tab

_top :- in the entire browser window i.e. “breaks out of all frames”.

_parent :- in the parent of the current frame.

Example: <form target=”_blank”>

error: Content is protected !!