Take the 2-minute tour ×

I'm trying to pass a POST variable to one of my controllers, however I'm doing this from a static page (I know, not the cleanest and most efficient way to go about things. But for the sake of learning...). How can I read that POST variable in my controller if the POST data is being sent without a FormHelper form?

I'm posting the data using jQuery ajax, so this is without the CakePHP native "FormHelper".

Does this make sense? Let me know if I need to elaborate. I appreciate any help you can provide :)

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

You should be able to access the data with:


And if you follow the naming convention used by the FormHelper and name your input field like data[ModelName][FieldName], then you can access the data as usual with:

share|improve this answer
add comment

Don't forget Cake is just PHP.

class BazController extends AppController {

    function foo() {
        $foo = $_POST['bar'];
        $this->set('foobar', $foo);


is perfectly valid. But I would do as @dhofstet suggests as it's much more "cakey".

share|improve this answer
add comment

Your Answer


