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" />
 
<?php
/* 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. ?>
  6. <input name="data[User][first_name]" value="" type="text" />
  7. <?php
  8. /* When the form is submitted to the controller via POST,
  9. the data shows up in $this->data. */
  10. //The submitted first name can be found here:
  11. $this->data['User']['first_name'];
  12. ?>