Learn HTML Forms by Building a Registration Form - Step 12

Tell us what’s happening:
Can someone please explain me the difference between POST and GET method in layman terms? I’d love to know what I’m actually doing and what difference will it make.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Registration Form</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <h1>Registration Form</h1>
    <p>Please fill out this form with the required information</p>

<!-- User Editable Region -->

    <form action='https://register-demo.freecodecamp.org' method="POST"></form>

<!-- User Editable Region -->

  </body>
</html>
/* file: styles.css */
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
  color: #f5f6f7;
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.42

Challenge: Learn HTML Forms by Building a Registration Form - Step 12

Link to the challenge:

The GET method will show key-value pairs in the URL when you submit a form tag. For example, you have 2 input tags that has name attributes ‘firstname’ and ‘lastname’ respectively. Once populated and submitted with a submit button tag, the URL would be something like this:

“www(dot)domain(dot)com?firstname=john&lastname=doe”

where the ‘firstname’ and ‘lastname’ are the keys (the name attribute of input tag in a form) and the value is what is passed in the input tag(‘john’ and ‘doe’) on the web page . The GET method is great when you want users to manipulate the query strings (the key-value pair) in the URL and when working with non-sensitive information like a youtube video time stamp or a google search.

On the other hand, the POST method will not show key-value pairs in the URL when you submit a form in a web page. This is great when you are working with sensitive information being passed in the form tag like email addresses or passwords.

2 Likes

Here is what the challenge is asking for
“ (with method="post" )” then take a look how you have it. It needs to match the challenge exactly If it’s capitalized or not

2 Likes

Thank you so much! Got it :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.