Here's the code which is not working:
$email = $this->request->get('emailFromPost','email','');
What I want is getting a right validated email variable $email
. While it's not working anyhow. Can anyone help me please?
Here's the code which is not working:
$email = $this->request->get('emailFromPost','email','');
What I want is getting a right validated email variable $email
. While it's not working anyhow. Can anyone help me please?
Follow this kind of way:
use Phalcon\Validation;
use Phalcon\Validation\Validator\Email;
...
$validation = new Validation;
$this->add('email', new Email(['message' => 'Email is not valid']));
if (count($messages = $validation->validate($data)) {
// iterate $messages
foreach ($messages as $message) {
echo $message."\n";
}
}