title: How do i access ejs data in a form while using express
body: <p>In the following code, I display the following HTML file upon user requests. I also want to access the clubname and type datavalues inside my app.post() function in my app.js file.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;
      &lt;link rel='stylesheet' href='/stylesheets/style.css' /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;% include templates/adminheader.ejs %&gt;
  &lt;h1&gt;Respond to Club Requests&lt;/h1&gt;
  
  &lt;form name="clubform" method="post"&gt;
      &lt;% for (var i in clubreq){%&gt;
          Club Name:&lt;%= clubreq[i].clubname %&gt;&lt;br&gt;&lt;br&gt;//I want to access this variable in my app.post() function
          Club Type:&lt;%= clubreq[i].type %&gt;&lt;br&gt;&lt;br&gt;
          &lt;input type="submit" value="accept"/&gt;&lt;br&gt;&lt;br&gt;&lt;hr&gt;
      &lt;%} %&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Inside <strong>app.js</strong>. Here I am rendering the HTML file upon user request</p>
  
  <pre><code>app.get('/clubreq', function(req, res, next){
          res.render('clubreq', {
              title: 'Club Requests',
              "clubreq" : docs
          });       
  });
  app.post('/clubreq', function(req, res, next){
      //I want to access clubname and type datavariables here and store it in my mongodb database
  });
  </code></pre>