Hi People,
I ve just started with some OOP programming in PHP and now i have to
build a set of classes that can generate a html form.. But i have a
problem with the <select><option></option></select> thing....
I hope someone can help me here or give me some pointers,... any help is
apreciated. Here is a part of my code :
class selectField extends formElement {
//Constructor
function selectField($name, $value) {
formElement::setName($name);
formElement::setValue($value);
}
function generateSelectField() {
$theOutput = "<select name=\"".$this->name."\">\n";
foreach($this->value as $key=>$val) {
$theOutput .= "<option
value=\"".$this->value."\">".$this->value."</option>\n";
}
$theOutput .= "</select>\n";
Return $theOutput;
}
}
This is how i call the Object:
$test[] = "Test1";
$test[] = "Test2";
$test[] = "Test3";
$test[] = "Test4";
$test[] = "Test5";
$select = new selectField("testje", $test);
echo$select->generateSelectField();
But all i get is a select box with the word Array in it 5 times...Thanks
for your time...
Best regards,
Davy Obdam
mailto:[EMAIL PROTECTED]
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php