Login   Register  
PHP Classes
elePHPant
Icontem

File: example.get2post.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gianluca Zanferrari  >  get2post  >  example.get2post.php  >  Download  
File: example.get2post.php
Role: Example script
Content type: text/plain
Description: example of usage
Class: get2post
Generate links that post forms
Author: By
Last change: added an example using an image instead of a text link.
Date: 2010-12-23 04:08
Size: 1,595 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>get 2 post</title>
</head>

<body>
<?php
require_once ('class.get2post.php');

//initiate class
$g2p = new getToPost;

if(isset(
$_POST) && count($_POST) > 0):

    
$_POST['Not_encrypted'] = 'This post variable where not encrypted and not decrypted';

    
$g2p->decrypt_post($_POST);
    echo(
'<pre>');
    
var_dump($_POST);
    echo(
'</pre>');
    
endif;

// parameters:
// 1st: action of the form
// 2nd: text shown as link (you can use an image too (html code)
// 3rd: string with values {&} separated ... as: name{=}John{&}surname{=}Joe{&}age{=}20
// 4rd: set text asked for confirmation (leave it empty for no question)

// write the JavaScript
$g2p->writeJS();

// make 1st link
$g2p->get2post($_SERVER['PHP_SELF'], 'Execute asking for confirmation.''Name{=}It is a long name as you see...{&}Surname{=}Something shorter{&}Age{=}251 years'$yesOrNo='Do you want to continue?');

echo 
"<br />\n";

// make 2nd link
$g2p->get2post ($_SERVER['PHP_SELF'], 'Execute without asking for confirmation...''Land{=}Italy{&}City{=}Alessandria{&}Nr{=}111222333');

//make link with pic
$g2p->get2post ($_SERVER['PHP_SELF'], '<br /><img src="http://www.google.nl/intl/en_com/images/srpr/logo1w.png" border="0" />''Search engine{=}Google{&}Land{=}Netherlands''Do you wanna see what SE it is?');
?>
</body>
</html>