Web Science/Part1: Foundations of the web/Dynamic Web Content/Forms and HTTP post request

From Wikiversity
Jump to: navigation, search

Forms and HTTP post request

Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Learning-goals.svg

Learning goals

  1. understand the basics of HTTP POST requests
  2. become aware of security issues while transfering data to a web server
  3. be able to create a simple web form in HTML
Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Video.svg

Video

Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Script.svg

Script

<html>
<head><title>Registration Form</title></head>
<body>
<h1>Registration Form for the Web Science MOOC</h1>
<form action="servlet" method="POST">
<label for="userinput">Enter User:</label>
<input name="username" id="userinput" type ="text" onchange="validator()"/><span id="warning" style="color:red"></span>
<br>
<label for="emailinput">Enter email</label>
<input name="email" id="emailinput" type ="text" />
<br>
<input name="submit" id="submitbutton" type="submit" value="register"/>
</form>
</body>
</html>
Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Quiz.svg

Quiz

1 How can a client transfer any arbitrary (especially binary) data to a web server?

Placing the data in the HTTP Header
Use the form tag in HTML with method POST.
Making a GET request and appending data to the query string
In the header of a POST request
In the body of a POST request
In the body of a multipart/form-data POST request

2 What do we have to keep in mind when submitting a web form?

Only submit data and personal information if you trust the recipient web site and the transmission of the data is encrypted.
If HTTP is used all routers on your route to the server can access your data
If HTTPS is used all routers on your route to the server can access your data
The GET request for transfering form data to a server was first introduced in HTTP/1.1

Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Further-readings.svg

Further reading

no further reading defined
You can define further reading here.
In general you can use the edit button in the upper right corner of a section to edit its content.
Wikiversity-Mooc-Icon-Discussion.svg

Discussion