01-13-2021, 02:01 AM
Why we cant use trim(), htmlspecialchars() like methods in form validation rules?
for example......
Is there any easy way that we can sanitize $_POST data at once?
I know we can do something like htmlspecialchars($request->getPost('name'));
But its nice if there any way that can pass a array like validation rules and sanitize multiple post vars at once. than wrapping with php native methods.
thanks.
for example......
PHP Code:
'name' => [
'label' => 'Name',
'rules' => 'trim|htmlspecialchars|required'
];
Is there any easy way that we can sanitize $_POST data at once?
I know we can do something like htmlspecialchars($request->getPost('name'));
But its nice if there any way that can pass a array like validation rules and sanitize multiple post vars at once. than wrapping with php native methods.
thanks.