Starting HTML- For beginners

Written by Stephen Cope

Starting HTML-For beginners

Starting HTML- 5 part series

A 5 part series for beginners who have never seen HTML before. Starting withrepparttar very basics and building up to creating links. The Series is designed to cover enough HTML for Webmasters who will be creating their website using WYSIWYG web page editors like FrontPage, DreamWeaver, Trellian Webpage etc but would like to be able to manually edit web pages to add scripts like Google Adsense or a web counter etc.

I would recommend that you follow through in order butrepparttar 105570 links torepparttar 105571 individual sections are also given below.

  • Part1-An Introduction to HTML-Your first Web Page
  • Part2-HTML TAGS Explained

Developing State-enabled Applications With PHP

Written by John L

Installment 1

Developing State-enabled Applications With PHP

When a user is browsing through a website and is surfing from one web page to another, sometimesrepparttar website needs to rememberrepparttar 105569 actions (e.g. choices) performed byrepparttar 105570 user. For example, in a website that sells DVDs,repparttar 105571 user typically browses through a list of DVDs and selects individual DVDs for check out atrepparttar 105572 end ofrepparttar 105573 shopping session. The website needs to remember which DVDsrepparttar 105574 user has selected becauserepparttar 105575 selected items needs to be presented again torepparttar 105576 user whenrepparttar 105577 user checks out. In other words,repparttar 105578 website needs to rememberrepparttar 105579 State - i.e.repparttar 105580 selected items - ofrepparttar 105581 user's browsing activities.

However, HTTP is a Stateless protocol and is ill-equipped to handle States. A standard HTML website basically provides information torepparttar 105582 user and a series of links that simply directsrepparttar 105583 user to other related web pages. This Stateless nature of HTTP allowsrepparttar 105584 website to be replicated across many servers for load balancing purposes. A major drawback is that while browsing from one page to another,repparttar 105585 website does not rememberrepparttar 105586 State ofrepparttar 105587 browsing session. This make interactivity almost impossible.

In order to increase interactivity,repparttar 105588 developer can userepparttar 105589 session handling features of PHP to augmentrepparttar 105590 features of HTTP in order to rememberrepparttar 105591 State ofrepparttar 105592 browsing session. The are basically 2 ways PHP does this: 1. Using cookies 2. Using Sessions

The next installment discusses how to manage sessions using cookies...

Installment 2


Cookies are used to store State-information inrepparttar 105593 browser. Browsers are allowed to keep up to 20 cookies for each domain andrepparttar 105594 values stored inrepparttar 105595 cookie cannot exceed 4 KB. If more than 20 cookies are created byrepparttar 105596 website, onlyrepparttar 105597 latest 20 are stored. Cookies are only suitable in instances that do not require complex session communications and are not favoured by some developers because of privacy issues. Furthermore, some users disable support for cookies at their browsers.

The following is a typical server-browser sequence of events that occur when a cookie is used: 1. The server knows that it needs to rememberrepparttar 105598 State of browsing session 2. The server creates a cookie and usesrepparttar 105599 Set-Cookie header field inrepparttar 105600 HTTP response to passrepparttar 105601 cookie torepparttar 105602 browser 3. The browser readsrepparttar 105603 cookie field inrepparttar 105604 HTTP response and storesrepparttar 105605 cookie 4. This cookie information is passed along future browser-server communications and can be used inrepparttar 105606 PHP scripts as a variable

PHP provides a function called setcookie() to allow easy creation of cookies. The syntax for setcookie is: int setcookie(string name, [string val], [int expiration_date], [string path], string domain, [int secure])

The parameters are: 1. name - this is a mandatory parameter and is used subsequently to identifyrepparttar 105607 cookie 2. value -repparttar 105608 value ofrepparttar 105609 cookie - e.g. ifrepparttar 105610 cookie is used to storerepparttar 105611 name ofrepparttar 105612 user,repparttar 105613 value parameter will storerepparttar 105614 actual name - e.g. John 3. expiration_date -repparttar 105615 lifetime ofrepparttar 105616 cookie. After this date,repparttar 105617 cookie expires and is unusable 4. path -repparttar 105618 path refers torepparttar 105619 URL from whichrepparttar 105620 cookie is valid and allowed 5. domain -repparttar 105621 domainrepparttar 105622 createdrepparttar 105623 cookie and is allowed to readrepparttar 105624 contents ofrepparttar 105625 cookie 6. secure - specifies ifrepparttar 105626 cookie can be sent only through a secure connection - e.g. SSL enable sessions

The following is an example that displays torepparttar 105627 user how many times a specific web page has been displayed torepparttar 105628 user. Copyrepparttar 105629 code below (bothrepparttar 105630 php andrepparttar 105631 html) into a file withrepparttar 105632 .php extension and test it out.

[?php //check ifrepparttar 105633 $count variable has been associated withrepparttar 105634 count cookie if (!isset($count)) { $count = 0; } else { $count++; } setcookie("count", $count, time()+600, "/", "", 0); ?]

[html] [head] [title]Session Handling Using Cookies[/title] [/head] [body] This page has been displayed: [?=$count ?] times. [/body] [/html]

The next installment discusses how to manage sessions using PHP session handling functions with cookies enabled...

Cont'd on page 2 ==> © 2005
Terms of Use