Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Spring 2019

## Get vs. Post

get: form information sent from browser to server as part of query string, visible in the URL

- Query String

- `http://host/path?param1=value1&param2=value2&param3=value3`
- Question mark
- Ampersand separated parameter/value pairs
- parameter=value

post: form information sent from browser to server as part of HTTP body; not in URL
Example 3.2 - Simple for using 'get' - Example 3.2 | <form method="get" action="https://cscie12.dce.harvard.edu/echo" enctype="application/x-www-form-urlencoded"> Email Address:<input type="text" name="email"/><br/><input type="submit"/></form>

- Markup
- Display

    <form method="get" action="https://cscie12.dce.harvard.edu/echo">
    Email Address:
    <input type="text" name="email"/><br/>
    <input type="submit"/>
    </form>

Email Address:
Example 3.3 - Simple form using 'post' - Example 3.3 | <form method="post" action="https://cscie12.dce.harvard.edu/echo" enctype="application/x-www-form-urlencoded"> Email Address:<input type="text" name="email"/><br/><input type="submit"/></form>

- Markup
- Display

    <form method="post" action="https://cscie12.dce.harvard.edu/echo">
    Email Address:
    <input type="text" name="email"/><br/>
    <input type="submit"/>
    </form>

Email Address:

Copyright © David Heitmeyer