title: Passing variable from view to controller with POST in CakePHP
body: <p>I'm new to CakePHP, and am trying to do some blog-like exercise, then I ran into some problems.</p>
  
  <p>See have a Model called <code>Post</code>, then under the <code>PostsController</code> I generated a <code>view</code> action for checking a single blog post. What I want is to allow the users to be able to add comment to the post in the <code>Posts/view</code> page instead of being redirected to a new <code>Comments/add</code> page. To do that I need to tell my <code>CommentsController</code> which post the user is commenting on. So wrote this in my <code>/app/View/Posts/view.ctp</code>:</p>
  
  <pre><code>&lt;?php
  
  echo $this-&gt;Form-&gt;create('Comment', array('controller' =&gt; 'comments', 'action' =&gt; 'add');
  echo $this-&gt;Form-&gt;input('content', array('row' =&gt; '3'));
  
  // this is the line I'm not sure about
  echo $this-&gt;Form-&gt;input('post_id', array('default' =&gt; $post['Post']['id'], 'type' =&gt; 'hidden'));
  
  echo $this-&gt;Form-&gt;end('Submit');
  
  ?&gt;
  </code></pre>
  
  <p>Now this solution will send the value of <code>$post['Post']['id']</code> to the <code>add</code> action in <code>CommentsController</code> in the form of <code>$this-&gt;request-&gt;data['post_id']</code>, but call me anal, I worry that whether this is the correct, or "professional" way to do this, since one can easily make the hidden field visible by altering some attributes with "inspect element' inside of any modern browser, leaving not necessarily potential security vulnerabilities, but something I personally don't feel comfortable with. So please, if anyone's worked with CakePHP before, share some experience with me on that.</p>