WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : This class preserves variables between templates. It supports links, forms, images and location's
Categories : PHP, Variables Update Picture
Jorge Machin
Date : Jan 17th 1999
Grade : 3 of 5 (graded 3 times)
Viewed : 3932
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Jorge Machin
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php

/* ------------------------------------------------------------------------
Módulo : REF.inc ( clase REF )
Autor : Jorge Renato Machin Ibarra
Inicio : Septiembre 24 de 1998
Final : Septiembre 25 de 1998
Comentarios : Estaba bonita hasta que Antelmo pidió cambios
Dedicada a Cecilia, Regina, Alicia, Lidia y Diana

example:

$REF = new REF;

$REF -> preserve( "var1", "var2");

$var1 = "var1 value 1";
$var2 = "var2 value 2";

$REF -> curl("mypath", "message");

$var1 = "var1 value 2";
$var2 = "var2 value 2";

$REF -> curl("mypath", "message");


You can make several instances of the class REF to pass diferents
variables in links.

----------------------------------------------------------------------- */





class REF {

var $Arr;


// -----------------------------------------------------------------------
//
// -----------------------------------------------------------------------

function preserve( $CurlVar0 = "CURL-NULL", $CurlVar1 = "CURL-NULL",
$CurlVar2 = "CURL-NULL", $CurlVar3 = "CURL-NULL",
$CurlVar4 = "CURL-NULL", $CurlVar5 = "CURL-NULL",
$CurlVar6 = "CURL-NULL", $CurlVar7 = "CURL-NULL",
$CurlVar8 = "CURL-NULL", $CurlVar9 = "CURL-NULL" )
{


$curr = "CurlVar0";

for ( $i = 0 ; $i < 10 && $$curr != "CURL-NULL"; $i++, $curr = "CurlVar".$i )

$this->Arr[] = $$curr;

}


function GetParams() {

// Declara las variables globales:

if ( empty ( $this -> Arr ) )

$elements = 0;

else

$elements = count( $this -> Arr );


for( $i = 0; $i < $elements; $i++ ) {

$Curlvar = $this -> Arr[$i];

global $$Curlvar;

if ( $$Curlvar != "" ) {

if ( $param != "" )

$param .= "&";

$param .= $Curlvar . "=" . urlencode( $$Curlvar );


}

}

if ( $param != "" )

$param = "?" . $param;


return $param;

}



// ----------------------------------------
//
// ----------------------------------------

function chidden() {


// Declara las variables globales:

if ( empty( $this->Arr ) )

$elements = 0;

else

$elements = count( $this->Arr );


for( $i = 0; $i < $elements; $i++) {

$var = $this->Arr[$i];

global $$var;

if ( $$var != "" ) {

echo( "<INPUT TYPE=\"HIDDEN\" NAME=\"$var\" VALUE=\"". $$var. "\">\n");

}

}


}


// ----------------------------------------
// clocation
// ----------------------------------------

function clocation( $path ) {

header( "Location: ".$path.$this->GetParams());

}


// ----------------------------------------
// curl
// ----------------------------------------

function curl( $path, $msg, $target = "") {


echo( "<A HREF=\"$path".$this->GetParams(). "\"" );

if ( $target != "" )

echo( " TARGET = \"$target\"");


echo( ">$msg</A>\n" );

}


// ----------------------------------------
// gurl
// ----------------------------------------

function gurl( $path, $imgPath, $msg = "", $target = "" ) {

echo( "<A HREF=\"$path".$this->GetParams(). "\"");

if ( $target != "" )

echo( " TARGET = \"$target\"");

echo( ">" );
echo( "<img src=\"".$imgPath. "\" BORDER=\"NO\" ALT =\"".$msg. "\">" );
echo( "</A>" );

}

// ----------------------------------------
// Area
// ----------------------------------------

function carea( $shape, $coords, $path, $msg ) {

echo( "<AREA SHAPE = \"$shape\" COORDS = \"$coords\" HREF=\"$path" );
echo( $this->GetParams() . "\" ALT = \"" . $msg . "\">\n" );

}

}

?>



Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET
Categories : Algorithms, HTML and PHP, PHP, Variables
clearing variables in php3
Categories : Variables, Arrays, PHP
A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors
Categories : PHP, Variables, Errors and Logging
This functions compares the current PHP version with a desired version. Because of the 3 tiered version system, a direct compare of a string to phpversion() will not be accurate.
Categories : PHP Configuration, PHP, Variables
How to control the number of decimal places when outputting numbers.
Categories : PHP, Strings, Variables
Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem
Newbie Notes #5 - To double quote, or single quote, that is the question
Categories : PHP, Beginner Guides, Variables
A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables
Display variables when a form is submitted using POST/GET
Categories : PHP, Functions, Variables, Debugging
Accessing GET and PUT variables with HTTP_GET_VARS on Win2K.
Categories : PHP, Windows 2000, Variables
Pageinfo: Array containing page URI, page query string (parameters), request method (GET or POST) and the complete URI
Categories : Variables, PHP Options and Info, Arrays, URLs, PHP
How to implement a session tracking system.
Categories : PHP, Sessions, Variables
serialize -- Generates a storable representation of a value
Categories : PHP, PHP Functions, Variables
Variable serialization and unserialization. Loading and saving variable structures to and from file.
Categories : Arrays, Filesystem, Variables, Strings, PHP
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel