16-cookies/index.php File Reference

This program is used to demonstrate use of Cookies from PHP program. More...

Go to the source code of this file.

Enumerations

enum  COOKIE_LIFE
 Used to define life of cookie in seconds with respect to now. More...

Functions

 get_post ($var1)
 This function returns value of POST variable whose name is given as argument.
 main ()
 This function checks if page was submitted using 'Add' or 'Delete' or not.
 show_cookies_page ($message)
 This function displays a form with text areas and buttons for adding cookies.

Variables

 $cookie_list = get_post('cookie_list')
 Used to store array of cookies to be deleted.
 $cookie_name = get_post('cookie_name')
 Used to store name of new cookie to be added.
 $cookie_value = get_post('cookie_value')
 Used to store value of new cookie to be added.
 $submit1 = get_post('submit1')
 Used to store value of first submit button 'Add'.
 $submit2 = get_post('submit2')
 Used to store value of first submit button 'Subtract'.


Detailed Description

This program is used to demonstrate use of Cookies from PHP program.

This is used as example for teaching PHP.

Author:
Saurabh Barjatiya
Version:
1.0

Definition in file index.php.


Enumeration Type Documentation

enum COOKIE_LIFE

Used to define life of cookie in seconds with respect to now.

Definition at line 11 of file index.php.


Function Documentation

get_post ( var1  ) 

This function returns value of POST variable whose name is given as argument.

If variable is not set it returns empty string "" as variable value.

Parameters:
var1 Name of variable whose value should be searched in POST array
Returns:
Value of variable in POST array. It returns empty string if variable is not present in POST array.

Definition at line 38 of file index.php.

main (  ) 

This function checks if page was submitted using 'Add' or 'Delete' or not.

If one of those buttons was pressed then corresponding action is performed before displaying the page.

Returns:
Nothing

Definition at line 100 of file index.php.

References $cookie_list, $cookie_name, $cookie_value, $message, $submit1, $submit2, and show_cookies_page().

show_cookies_page ( message  ) 

This function displays a form with text areas and buttons for adding cookies.

Below the form existing cookies are listed in select list and delete option for deleting existing cookies is provided.

Parameters:
message Message to be displayed at top of page.
Returns:
Nothing

Definition at line 55 of file index.php.

References $cookie_name, $cookie_value, $message, and $submit1.

Referenced by main().


Variable Documentation

$cookie_list = get_post('cookie_list')

Used to store array of cookies to be deleted.

Definition at line 26 of file index.php.

Referenced by main().

$cookie_name = get_post('cookie_name')

Used to store name of new cookie to be added.

Definition at line 20 of file index.php.

Referenced by main(), and show_cookies_page().

$cookie_value = get_post('cookie_value')

Used to store value of new cookie to be added.

Definition at line 23 of file index.php.

Referenced by main(), and show_cookies_page().

$submit1 = get_post('submit1')

Used to store value of first submit button 'Add'.

Definition at line 14 of file index.php.

Referenced by main(), and show_cookies_page().

$submit2 = get_post('submit2')

Used to store value of first submit button 'Subtract'.

Definition at line 17 of file index.php.

Referenced by main().


Generated on Fri Nov 4 14:16:55 2011 for PHP example documentation by  doxygen 1.4.7