コード例 #1
0
ファイル: index.php プロジェクト: evandrolacerda/HTMLTags
$form = new HTMLForm('form_1');
$divNome = new HTMLDIV('d_nome');
$form->setMethod('POST');
$form->setAction($_SERVER['SCRIPT_NAME']);
$label = new HTMLLabel('Nome', 'i_nome');
$inputNome = new HTMLInput('text', 'i_nome');
$inputNome->addAttribute('value', "Evandro Pereira de Lacerda");
$inputNome->addAttribute('size', 60);
$text = new HTMLTextNode('Nome');
$label->addChild($inputNome);
$divNome->addChild($label);
//***************************************************
$divNascimento = new HTMLDIV('d_nasc');
$labelNascimento = new HTMLLabel("Data de Nascimento", 'i_nasc');
$nascimento = new HTMLInput('date', 'i_nasc');
$nascimento->addAttribute('size', 25);
$nascimento->addClass('input_n');
$nascimento->addClass('input_md');
$labelNascimento->addChild($nascimento);
$divNascimento->addChild($labelNascimento);
//***************************************************
$arrayOptions = ['Corsa', 'Fiesta', 'Cobalt', 'Onix', 'Escort', 'Ipanema', 'Uno', 'Palio', 'Gol', 'Verona'];
$select = new HTMLSelect('carros');
foreach ($arrayOptions as $opt) {
    if ($opt === 'Fiesta') {
        $select->addChild(new HTMLOption($opt, $opt, true));
    } else {
        $select->addChild(new HTMLOption($opt, $opt));
    }
}
$divTextArea = new HTMLDIV('text_area');