Thank you the code help.
I'm trying to get some output form the fields in the table object but i get nothing returned.
Am i referencing the fields incorrectly or did i set them up wrong? I get the feeling i'm missing something
In VB i would just do "print table.fields[1].text" and looking at the documentation i figure it should be $table->$fields[1].$text
<html>
<body>
<?php
// start definitions
class Field
{
var $name;
var $label;
var $size;
var $maxchar;
var $type;
var $validationrule;
function Field ($name, $label, $size, $maxchar, $type, $validationrule) {
$this->name = $name;
$this->type = $type;
$this->label=$label;
$this->size=$size;
$this->maxchar=$maxchar;
$this->validationrule=$validationrule;
}
function PrintName() {
echo "Print Name : " . $this->name;
}
}
class Table
{
var $fields = array();
function addField($field)
{
$this->fields[] = $field;
}
}
// end definitions
$table = new Table();
$table->addField(new Field('username','text','User name:','10','10','NO NULL'));
$table->addField(new Field('password','password','Password:','10','10','NO NULL'));
$table->addField(new Field('firstname','text','First name:','10','10','NO NULL'));
$table->addField(new Field('lastname','text','Last name:','10','10','NO NULL'));
$table->addField(new Field('city','text','City:','15','15','NO NULL'));
$table->addField(new Field('state','text','State:','2','2','NO NULL'));
echo "1" . $table->$fields[0]->$text . "<BR>"; // only get 1 in output
$table->$fields[0]->printname; // no ouput
?>
</body>
</html>