title: Prestashop Handle post data in custom CMS form
body: <p>I've developped a prestashop module that display a form, and now I want to use the POST data to store my data in the database.</p>
  
  <p>Following some tutorials I'm able to display the form and load some js file, but my question are two:</p>
  
  <ul>
  <li><p>What will be the action parameter of my form?</p></li>
  <li><p>How can i handle the post parameters, and where??</p></li>
  </ul>
  
  <p>The structure of my module is this - root is /modules/mymodule/ dir:</p>
  
  <ul>
  <li><p>mymodule.php</p></li>
  <li><p>/views/templates/hook/mymodule.tpl</p></li>
  <li><p>/views/js/front.js</p></li>
  </ul>
  
  <p>Have i to insert a controller??</p>
  
  <p>Thank you.</p>
  
  <p><strong>EDIT- Add some code</strong></p>
  
  <p>mymodule.php</p>
  
  <pre><code>class MyModule extends Module
  {
      public function __construct()
      {
          $this-&gt;name = 'mymodule';
          $this-&gt;controllers = array( 'display' ); // &lt;- my controller name
  
          parent::__construct();
      }
  
      public function install()
      {
         if (Shop::isFeatureActive())
           Shop::setContext(Shop::CONTEXT_ALL);
  
         if (!parent::install() ||
           !$this-&gt;registerHook('customCMS') ||
           !$this-&gt;registerHook('header')
         )
            return false;
  
         return true;
       }
  
      public function hookcustomCMS($params)
      {
          if (Tools::getValue('id_cms') != 7)
              return;
  
        $this-&gt;context-&gt;smarty-&gt;assign(
            array(
                'form_link' =&gt; $this-&gt;context-&gt;link-&gt;getModuleLink('mymodule', 'display')
            )
        );
  
        return $this-&gt;display(__FILE__, 'mymodule.tpl');
      }
  }
  </code></pre>
  
  <p>mymodule.tpl</p>
  
  <pre><code>&lt;form id="myform" action="{$link-&gt;getModuleLink('mymodule', 'display')|escape:'html'}" method="post"&gt;
  &lt;!-- all fields...  + submit button --&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>display.php (this shoul be the controller in mymodule/controllers/front)</p>
  
  <pre><code>&lt;?php
  class mymoduledisaplyFrontController extends ModuleFrontController
  {
  
  
      public function initContent()
      {
          parent::initContent();
  
  
          $this-&gt;context-&gt;controller-&gt;addJS($this-&gt;module-&gt;getLocalPath().'views/js/front.js');
          $this-&gt;setTemplate('mymodule.tpl');
      }
  
  
  
      public function postProcess()
      {
        if (Tools::isSubmit('submit_requestform'))
        {
            // form processing
  
            ppp("OK");
  
  
        }
      }
  
  }
  </code></pre>
  
  <p>That's all...</p>