user1479469
user1479469

Reputation: 45

Accessing form values - Cakephp

Hi all i have a form in cakephp .i have to access the user entered values after clicking submit.In my form below ,after clicking sumbit am storing values in my controller part,there i use echo $-POST['name'] to display user entered name but its not getting displayed .Can anyone help?Note:Cakephp-2.3

    <h1>Add Comment</h1>
       <?php
       $post_id= $posts['Post']['id']; 
        echo $this->Form->create('Comment',array('action' => 'comment','url' =>    
        array($post_id,$flag)));
        echo $this->Form->input('name');
       echo $this->Form->input('email');
       echo $this->Form->input('text', array('rows' => '3'));
       echo "Enter Captcha Code:    ";   
       echo $this->Html->image(
        array('controller' => 'posts', 'action' => 'captcha'));
        echo $this->Form->input('code');
       echo $this->Form->end('Add comment'); 
     ?>

Upvotes: 0

Views: 2927

Answers (1)

Oldskool
Oldskool

Reputation: 34837

This is all explained in the Blog tutorial of the documentation.

When a user uses a form to POST data to your application, that information is available in $this->request->data. You can use the pr() or debug() functions to print it out if you want to see what it looks like.

Upvotes: 3

Related Questions