3.5.2.4.8 data

$this->data
  1. $this->data

Used to handle POST data sent from the FormHelper forms to the controller.

<?php

// The FormHelper is used to create a form element:

$form->text('User.first_name');

// When rendered, it looks something like:

<input name="data[User][first_name]" value="" type="text" />

// When the form is submitted to the controller via POST,
// the data shows up in $this->data.

//The submitted first name can be found here:
$this->data['User']['first_name'];

?>
  1. <?php
  2. // The FormHelper is used to create a form element:
  3. $form->text('User.first_name');
  4. // When rendered, it looks something like:
  5. <input name="data[User][first_name]" value="" type="text" />
  6. // When the form is submitted to the controller via POST,
  7. // the data shows up in $this->data.
  8. //The submitted first name can be found here:
  9. $this->data['User']['first_name'];
  10. ?>