title: NodeJS, express: post data from one page to another
body: <p>I have to post some data from one page to another page. I am using express with NodeJS.</p>
  
  <p>I have written below code :<br/></p>
  
  <pre><code>var express = require('express');  
  var app = express();
  
  app.get('/', function (req, res) {
     res.sendFile( __dirname + "/index.html" );
  });
  
  app.get('/RegistrationPage', function (req, res) {
     res.sendFile( __dirname + "/RegistrationPage.html" );
  });
  
  app.post('/RegistrationSuccessPage', function (req, res) {
     var uname = req.body.username
     var pwd = req.body.pwd
     var emailAddress = req.body.email
     postData = uname+","+pwd+","+emailAddress
     console.log(postData);
     res.sendFile( __dirname + "/RegistrationSuccessPage.html",uname);
  });
  </code></pre>
  
  <p>On navigating to "RegistrationSuccessPage", the values of uname, pwd, emailAddress are being printed as undefined.</p>
  
  <p>I have used below code too but it did not helped:<br/></p>
  
  <pre><code>app.post('/RegistrationSuccessPage', function (req, res) {
     var uname = req.query.username
     var pwd = req.query.pwd
     var emailAddress = req.query.email
     postData = uname+","+pwd+","+emailAddress
     console.log(postData);
     res.sendFile( __dirname + "/RegistrationSuccessPage.html",uname);
  });
  </code></pre>
  
  <p>Can someone please help that how I can get values from text boxes and post them on other page.</p>
  
  <p>HTML code is as below:<br/></p>
  
  <pre><code>&lt;body&gt;
          &lt;div&gt;   
              &lt;div align="center"&gt;
                  &lt;label&gt;Please enter below details&lt;/label&gt;&lt;br&gt;&lt;br&gt;
                  &lt;label&gt;Username *: &lt;/label&gt;&lt;input type="username" name="username"/&gt;&lt;br&gt;&lt;br&gt;
                  &lt;label&gt;Password *: &lt;/label&gt;&lt;input type="password" name="pwd" /&gt;&lt;br&gt;&lt;br&gt;         
                  &lt;label&gt;Email Address *: &lt;/label&gt;&lt;input type="email" name="email"&gt;&lt;br&gt;&lt;br&gt;
                  &lt;br&gt;&lt;br&gt;
                  &lt;form action="/RegistrationSuccessPage" method="post"&gt;&lt;input type="submit" value="Submit" /&gt;&lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt; 
  </code></pre>