Client/Server Architecture
How The Client Side Sends Data
action
attribute form defines where the data will be sentex/Absolute URL:
<form action="https://example.com">
ex/Relative ULR
<form action="/somewhere_else">
if no value is given to action attr, the data will be sent to the same page that the form is on
name=value
of form are sent to server joined with ampersands(&)Browser uses the GET method to send a request to the server asking for a sources. the body of information sent to the server is appended to the URL in a series of name=value pairs, each separated by an &
Browser uses the POST to ask for a response correlating with data that is already within the body of the HTTP request if a form is used.
if you need to send sensitive data, do not use GET method!
if you need to send large amount of data, use POST METHOD
The server receives a string and will be parsed to get the data as list of key=value pairs. Refer to Express For Receiving Data
Files are binary data
To send files:
multipart/form-data
<input type="file">
so user can select files to upload.ex:
<form method="post" action="https://www.foo.com" enctype="multipart/form-data">
<div>
<label for="file">Choose a file</label>
<input type="file" id="file" name="myFile">
</div>
<div>
<button>Send the file</button>
</div>
</form>