GET and Post Forms

For sending the information from the client to the server that you fill on your form we need to have "method=get" or "method=post" attributes. there are differences between the get and post methods. when we give "method=get".it sends the user data in URL form. when we fill the sensitive data like bank account details or social media user id password hacker can easily retrieve our information and misuses it.let us see some examples

<form method="get">
        <fieldset>
            <legend>User registration</legend>
            <label for="username">Enter your username</label>
            <input type="text " name="username" id="username">
            <br>
            <label for="userenail">Enter your email:</label>
            <input type="email" name="usermail" id="usermail">
            <br>
            <label for="userpassword">password</label>
            <input type="password" name="userpassword" id="userpassword">
            <br>
            <label for="male">MALE</label>
            <input type="radio" name="gender" id="male">
            <br>
            <label for="female">Female</label>
            <input type="radio" name="gender" id="female">
            <br>
            <label for="transgender">transgender</label>
            <input type="radio" name="gender" id="transgender">
            <br>
            <input type="submit" value="submit-button">
        </fieldset>
    </form>

in the above example, we give "method =get" when we put some information into the form field. the URL we get is.

http://127.0.0.1:5500/samplehtmlform.html?username=satya&usermail=sart%40ghabjk.com&userpassword=ihgiuhgi&gender=on

see what we put on the form and submit it all the information others can see.so for security purpose we use "method=post".

POST carries a request parameter in the message body which makes it a more secure way of transferring data from client to server.