Advanced Commercial Web Site Design: ServerSide Scripting - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Advanced Commercial Web Site Design: ServerSide Scripting

Description:

form action=' http://ace2069.group.shef.ac.uk/comweb2/post.php ' method='POST' ... Site navigation. Searching. When to use POST method: ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 7
Provided by: Gan58
Category:

less

Transcript and Presenter's Notes

Title: Advanced Commercial Web Site Design: ServerSide Scripting


1
Advanced Commercial Web Site Design Server-Side
Scripting
  • Session 6-1
  • Interacting with web-pages (B)

2
Outline
  • Form processing in PHP
  • POST method
  • Advantages / Disadvantages

3
POST method
  • It passes information (arguments) from one
    web-page to another by including it in the body
    of the form. Nothing is visible to the URI
    string.
  • Advantages
  • Security The information entered by the user is
    not shown to the query string or the server logs.
  • Capacity The limit of the amount of data is
    larger than in GET method.
  • Disadvantages
  • Bookmarks The results cannot be stored as
    bookmarks since the URL is always the same.
  • Firewall Some strict firewalls tend to strip the
    body of the forms and the included information is
    lost.

1. Uniform Resource Indicator. Also known as URL
(Uniform Resource Locator)
4
Example on POST method
  • Assume a HTML file with a simple form like the
    following
  • ltbodygt
  • ltform action" http//ace2069.group.shef.ac.uk/co
    mweb2/post.php " methodPOST"gt
  • ltpgtFirst name ltinput type"text" size12
    name"FirstName"gt
  • ltpgtltinput type"submit"gt
  • lt/formgt
  • lt/bodygt
  • And the corresponding PHP script with the
    following code
  • ltbodygt
  • lt?php
  • print("Your first name is FirstName!")
  • ?gt
  • lt/bodygt

5
Use of GET POST method
  • When to use GET methodWhen we need to pull
    information (non-secure)
  • Site navigation
  • Searching
  • When to use POST methodWhen we need to put
    information to the back-end storage and be secure
  • Add information to a database
  • Authentication/Authorization

6
Exercise 6.1-1
  • Convert the bank details exercise (5.2) to use
    the POST method instead of GET.
  • Which parts of the code should be changed?
  • Which method is better for this exercise and why?
Write a Comment
User Comments (0)
About PowerShow.com