Thanks for your help, but in this case i ve to build everythng up from the ground. Next time i`ll definatly take a look at smarty. It works now..
Best regards,
Davy Obdam
mailto:[EMAIL PROTECTED]
Peter J. Schoenster wrote:
On 7 Dec 2002 at 0:43, Davy Obdam wrote:
I ve just started with some OOP programming in PHP and now i have toBelow is an example that works. I don't know from formElement. But why, why in the world do you REALLY want to do this? Have you truly used and understood smarty and yet felt this must be done? I haven't.
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...
http://smarty.php.net/
It lets you focus on your application.
Peter
<?php
// require_once 'selectField.php';
$test[] = "Yea, this works";
$test[] = "No trouble mate";
$test[] = "Test3";
$test[] = "Test4";
$test[] = "Test5";
$select = new selectField("testje", $test);
echo $select->generateSelectField();
class selectField {
var $name;
var $value;
function selectField($name, $value) {
$this->name = $name;
$this->value = $value;
}
function generateSelectField() {
$theOutput = "<select name=\"".$this->name."\">\n";
foreach($this->value as $key=>$val) {
$theOutput .= "<option value=\"".$val."\">".$val."</option>\n";
}
$theOutput .= "</select>\n";
return $theOutput;
}
}
?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php