Created
April 10, 2022 16:51
-
-
Save estefanionsantos/e4ccd995d0e738272d8a39fe6d876036 to your computer and use it in GitHub Desktop.
form element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Rubricate\Element\CreateElement; | |
$name = new CreateElement('input'); | |
$name->setAttribute('type', 'text'); | |
$name->setAttribute('name', 'name'); | |
$name->setAttribute('required'); | |
$email = new CreateElement('input'); | |
$email->setAttribute('type', 'email'); | |
$email->setAttribute('name', 'email'); | |
$email->setAttribute('required'); | |
$submit = new CreateElement('input'); | |
$submit->setAttribute('type', 'submit'); | |
$submit->setAttribute('name', 'submit'); | |
$submit->setAttribute('value', 'ok'); | |
$form = new CreateElement('form'); | |
$form->setAttribute('action', 'process.php'); | |
$form->setAttribute('method', 'post'); | |
$form->addChild($name); | |
$form->addChild($email); | |
$form->addChild($submit); | |
echo $form->getElement(); | |
/* | |
<form action="process.php" method="post"> | |
<input type="text" name="name" required /> | |
<input type="email" name="email" required /> | |
<input type="submit" name="submit" value="ok" /> | |
</form> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment