Search code examples
cakephpsummernote

how to use html php special chars function in a form input?


I have input form in a add.ctp

echo $this->Form->input('Postdetail.0.post_text', array('label' => 'متن ', 'id' => 'editkoniman'));

And i want the result of that warped in a htmlspecialchars function befor saving in a database because i use summernote bootstrap WYSIWYG editor in a modal box


Solution

  • Let me explain how to implement your requirement.

    As like @mark said, just save the data in your controller

    $this->{YourModel}->save($this->request->data);
    

    Here $this->request->data contains your post data.

    To display the post_text in your view just put the strings in h() function to escape html characters

    h($yourvariable['ModelName']['post_text'])