PHP Classes

File: examples/examplearrayget3.php

Recommend this page to a friend!
  Classes of Jorge Castro   PHP Validation One Library   examples/examplearrayget3.php   Download  
File: examples/examplearrayget3.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Validation One Library
Fetch and validate forms and request values
Author: By
Last change:
Date: 4 months ago
Size: 776 bytes
 

Contents

Class file image Download
<form method="post">
    <input type='text' name='field[0][col1]' value="cocacola" />
    <input type='text' name='field[0][col2]' value="123" /><br>
    <input type='text' name='field[1][col1]' value="fanta" />
    <input type='text' name='field[1][col2]' value="123" /><br>
    <input type="submit"><br>
</form>
<?php

use eftec\ValidationOne;

include
"common.php";
$values=getVal('')->type('integer')->ifFailThenOrigin()->isArray(true)->request('field');
echo
"<h1>The validation</h1>";
var_dump(getVal('')->getMessageId('field')->allError());
//var_dump(getVal('')->getMessage());
echo "<h1>The values</h1>";
echo
"<pre>";
var_dump($values);
echo
"</pre>";
echo
"<h1>The values inverted</h1>";
echo
"<pre>";
var_dump(ValidationOne::invertArray($values));
echo
"</pre>";