13-post_variables/index.php File Reference

This page demonstrates use of POST method for passing form values. More...

Go to the source code of this file.

Functions

 get_post ($var1)
 This function returns value of POST variable whose name is given as argument.
 main ()
 This is where program execution starts.
 show_login_page ()
 This function displays login page which prints value of global variable message, followed by form for entering username and password.

Variables

 $message = ''
 Will be used to pass message to show_login_page() to be displayed before login form.


Detailed Description

This page demonstrates use of POST method for passing form values.

This page will display login form and if username and password 'match' it displays login succesful else it displays username and password do not match.

Author:
Saurabh Barjatiya
Version:
1.0

Definition in 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 25 of file index.php.

Referenced by main().

main (  ) 

This is where program execution starts.

It checks whether form was submitted or is being displayed for first time. If form is being displayed for first time it simply calls show_login_page(), If form was submitted it displays 'Username and password match' if username and password match. Otherwise it displays login form again with message 'Username and password do not match'.

Returns:
Nothing.

Definition at line 70 of file index.php.

References $message, get_post(), and show_login_page().

show_login_page (  ) 

This function displays login page which prints value of global variable message, followed by form for entering username and password.

Returns:
Nothing

Definition at line 40 of file index.php.

References $message.

Referenced by main().


Variable Documentation

$message = ''

Will be used to pass message to show_login_page() to be displayed before login form.

Definition at line 14 of file index.php.

Referenced by address_book_page(), display_add_form(), main(), show_cookies_page(), show_login_page(), and verify_post_data().


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