Referring to Super Global Array in Classes
Posted: Sun Sep 10, 2006 8:12 am
I seem to be having some issues when referring to post data array within a class. I am using the class below to echo out inputs within a HTML form. I am trying to create a sticky input however the class dose not see the POST data after a submit. I take it I don't need to declare it as global within the class as it is a super global array?
Many Thanks 
Code: Select all
class textinput {
var $name;
var $label;
var $size;
var $maxsize;
var $value;
var $nobr;
function display( ) {
$this->findvalue( );
$this->findmaxsize( );
$this->arrange( );
}
function arrange( ) {
echo "<label for=\"" . $this->name . "\">" . $this->label . " </label><input type=\"text\" name=\"" . $this->label . "\" size=\"" . $this->size . "\" maxlength=\"" . $this->maxsize . "\" value=\"" . $this->value . "\" />";
if (!isset($this->nobr)) { echo "<br>"; }
}
function findvalue( ) {
if (isset($_POST[$this->name])) { $this->value = $_POST[$this->name]; } else {
if(!isset($this->value)) { $this->value = ""; } }
}
function findmaxsize( ) {
if (!isset($this->maxsize)) { $this->maxsize = $this->size; }
}
}