PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 9, 2022

[FIXED] How to print the email after register in flash messages using cakephp3

 January 09, 2022     cakephp, cakephp-3.0     No comments   

Issue

<?php
public function add(){

// code 

      $this->Flash->activateUsers('Thank you for choosing our website', $this->request->getData('email'));

}

?>

then I create a file inside src\Template\Element\Flash\activate_users.ctp with the content below:

<div class="message success">
       <?= h($message) , $this->request->getData('email'); ?>
                  or
       <?= h($message) ?> <?=h($this->request->getData('email')) ?>
</div>

But after successfull filling up the form with no error it will just print this:

"Thank you for choosing our website"


Solution

In your controller:

$this->Flash->activateUsers('Thank you for choosing our website', [
    'params' => [
        'email' => $this->request->getData('email'),
    ]
]);

In your template:

<?= h($message) ?>, <?= h($params['email']) ?>

There's an example of this in the Flash component section of the manual.



Answered By - Greg Schmidt
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing