PHP Classes

File: example.basic.php

Recommend this page to a friend!
  Classes of Joshua Townsend  >  Request Data  >  example.basic.php  >  Download  
File: example.basic.php
Role: Example script
Content type: text/plain
Description: Example of basic use
Class: Request Data
Retrieve and process request parameters
Author: By
Last change:
Date: 15 years ago
Size: 746 bytes


Class file image Download
// Basic examples of use
require "request.class.php";

$request = new request();

$id = $request->get_int("id"); // Get the variable "id" from the $_REQUEST array as an integer, or, if it doesn't exist, return 0

$name = $request->get_string("name", "gp"); // Get the variable "name" from the $_POST array if it exist, if it doesn't exist, the $_GET array, or, if it exists in neither, return ""

$fullname = $request->get_string("fullname", "gp", "Smith"); // Same as above for the "fullname" variable, but return "Smith" if it is not found

$host = $request->get_string("HTTP_HOST", "s"); // Get the "HTTP_HOST" variable from the $_SERVER array. See also the use of request::get_header() for HTTP headers through $_SERVER

For more information send a message to info at phpclasses dot org.