We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How do we get the value of a checkField in a post ?

Hi !

How do we get the value of a checkField in a post ?

<?php echo Phalcon\Tag::checkField(array("IsSuspect")); ?>

$this->request->getPost("IsSuspect"); ====> ALWAYS EQUAL TO FALSE

Thank

If you look at the field does the name='IsSuspect'? If you do $_POST['IsSuspect']; does it return anything?

See here: https://docs.phalcon.io/en/latest/api/Phalcon_Http_Request.html#methods

The method is: public mixed getPost ([string $name], [string|array $filters], [mixed $defaultValue])

So if you arent getting anything Id make sure the original $_POST works.



31.3k

Hi

$_POST['IsSuspect'];

yes it's there but it's always false.

This is the HTML generated by the tag :

<input type="checkbox" value="N" name="IsSuspect" id="IsSuspect">