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