PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Jaroslaw Katnik   Post   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Shows how to use the class.
Class: Post
Wrap the access to the HTTP POST request values
Author: By
Last change:
Date: 17 years ago
Size: 663 bytes
 

Contents

Class file image Download
<?php
   
require_once 'Post.inc';
   
//get instance
   
$post = Post::getInstance();
   
   
//get data - access $_POST array as it would be an object
   
$testValue = $post->testValue;
   
$step = $post->step;
   
    if (
$step == null) {
     
$step = 1;
    }
   
   
//increment
   
$testValue += $step;
  
?>
<html>
    <body>
        <form method="POST">
            Value to be incremented: <input type="text" name="testValue" value="<?=$testValue?>"/>
            <br/>Step: <input type="text" name="step" value="<?=$step?>"/>
            <br/><input type="submit" value="increment"/>
        </form>
    </body>
</html>