Para instalar HTML_Quickform en Windows se debe:
1.- abrir una consola de MS-DOS e ir a la siguiente ruta "C:\xampp\php" aquí debe existir un archivo llamado pear.bat.
2.- Si el archivo pear.bet se encuentra solo debe escribir la siguiente línea de código en la consola "pear.bat install html_quickform2" esto instalará los archivos necesarios en el computador.
3.- Para chequear que se instaló correctamente puede ubicar por la consola o por el explorador de Windows la siguiente ruta "C:\xampp\php\PEAR\HTML" allí debe tener el archivo llamado QuickForm.php.
NOTA: El Paquete html_quickform ha sido deprecado.
4.- Si desea verificasr el funcionamiento solo debe crear un archivo php con el siguiente código en él.
El código ha sido extraido de la documentación oficial del componenete; http://pear.php.net/manual/en/package.html.html-quickform2.tutorial.php
<?php
// Load the main class
require_once 'HTML/QuickForm2.php';
// Instantiate the HTML_QuickForm2 object
$form = new HTML_QuickForm2('tutorial');
// Set defaults for the form elements
$form->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
'name' => 'Joe User'
)));
// Add some elements to the form
$fieldset = $form->addElement('fieldset')->setLabel('QuickForm2 tutorial example');
$name = $fieldset->addElement('text', 'name', array('size' => 50, 'maxlength' => 255))
->setLabel('Enter your name:');
$fieldset->addElement('submit', null, array('value' => 'Send!'));
// Define filters and validation rules
$name->addFilter('trim');
$name->addRule('required', 'Please enter your name');
// Try to validate a form
if ($form->validate()) {
echo '<h1>Hello, ' . htmlspecialchars($name->getValue()) . '!</h1>';
exit;
}
// Output the form
echo $form;
?>
No hay comentarios:
Publicar un comentario