1. Go to this page and download the library: Download pframework/p-input library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pframework / p-input example snippets
$config = [
'first-name' => [
'name' => 'first_name', // mapped name
'/ validation
return false;
}
return $value; // could potentially filter before returning
},
'error' => 'First name must be more than 2 characters'
]
];
$is = new P\InputSet($config);
$result = $is->process($_POST); // use post in this case
$result->isValid();
echo $result['first_name'];
class FormController {
public function handle() {
if ($_POST) {
$inputResult = $this->getUserInput($_POST);
if ($inputResult->isValid()) {
var_dump($inputResult);
exit;
}
}
include 'form.phtml';
}
protected function getUserInput($source) {
$p = new P\InputSet([
'username' => [
'
html
<form method="POST" action="<?= $_SERVER['PHP_SELF']
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.