Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML GET and POST methods

Is it necessarily required that the action="abc.php" in FORM tag must have a PHP, JSP, ASP file? Can't simple HTML code display the data submitted in the FORM?

In other words,

FILE: abc.html

<form method="post" action="xyz.html">
     <input type="text" name="name" id="name" value="Enter your name here" />
</form>

OR

<form method="get" action="xyz.html">
         <input type="text" name="name" id="name" value="Enter your name here" />
</form>

Now in file xyz.html, can I display the name entered in abc.html using only HTML code?

like image 661
sumit Avatar asked Dec 21 '12 08:12

sumit


People also ask

What is difference between GET and POST method in HTML?

Both GET and POST method is used to transfer data from client to server in HTTP protocol but Main difference between POST and GET method is that GET carries request parameter appended in URL string while POST carries request parameter in message body which makes it more secure way of transferring data from client to ...

What is the difference between POST and GET request methods?

HTTP POST requests supply additional data from the client (browser) to the server in the message body. In contrast, GET requests include all required data in the URL.

What is POST method in HTML?

A method="post" attribute value specifies that the form data will be sent to the server by storing it in an HTTP request body. This method is used to transfer data securely using HTTP headers.


2 Answers

HTML by itself can't access submitted POST/GET data. You need a server side language (PHP, python, ruby, .NET, ...) to put those values into HTML.

That being said, you can post to a HTML page, you just won't be able to do anything with it.

You could use JavaScript to access GET variables, but not POST.

like image 159
Jan Hančič Avatar answered Sep 22 '22 01:09

Jan Hančič


You cannot dispaly it using html only. You need to have a server side scripting language like PHP,ASP.Net or java etc...

like image 36
Deepu Avatar answered Sep 20 '22 01:09

Deepu