title: how can i send switch toggle form through post method
body: <p>I'm using a ejs template and communicating with app.js through method='post'. how can i send form??</p>
  
  <p>In case of input text this approach below works.</p>
  
  <pre><code>&lt;form action="/login" method="POST"&gt;
              &lt;div class="form-group"&gt;
                &lt;label for="email"&gt;Email&lt;/label&gt;
                &lt;input type="email" class="form-control" name="username"&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                &lt;label for="password"&gt;Password&lt;/label&gt;
                &lt;input type="password" class="form-control" name="password"&gt;
              &lt;/div&gt;
              &lt;button type="submit" class="btn btn-dark"&gt;Login&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>but it's not the case with the switch toggle form below. how can i make it work?? </p>
  
  <pre><code> &lt;form action="/main" method="POST"&gt;
      &lt;div class="custom-control custom-switch"&gt;
        &lt;input type="checkbox" class="custom-control-input" id="sw1" name="toggle2"&gt;
        &lt;label class="custom-control-label" for="sw1"&gt;On/Off&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="custom-control custom-switch"&gt;
        &lt;input type="checkbox" class="custom-control-input" id="sw2" name="toggle1"&gt;
        &lt;label class="custom-control-label" for="sw2"&gt;on/off&lt;/label&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>On the server side, </p>
  
  <pre><code>app.post("/main",(req,res)=&gt;{
    console.log(req.body.toggle1,req.body.toggle2);
  });
  </code></pre>
  
  <p>it should log toggled items, but nothing has been returned.</p>
  
  <p>almost full code for the app.js(serverside)</p>
  
  <pre><code> const app = express();
      const bodyParser = require("body-parser");
      app.use(bodyParser.urlencoded({extended: true}));
      app.get("/main",(req,res)=&gt;{
        res.render("main");
      });
      app.post("/main",(req,res)=&gt;{
        console.log(req.body.toggle1,req.body.toggle2);
      });
  </code></pre>