title: Is there a way to use EJS variables in HTML inputs?
body: <p>I am trying use a check box to send all selected users to a new page and am wondering how this could be done (using mongodb to store information) My existing code is as follows,</p>
  <p>first I render the page</p>
  <pre><code>router.get(&quot;/admin&quot;, ensureAuthenticated,(req, res) =&gt; {
      User.find()
      .then(user =&gt; {
          res.render(&quot;admin&quot;, {
              user: user,
          });
  
      })
  });
  </code></pre>
  <p>For all of the users the website has I create a check box, and all selected users should get sent to a new page</p>
  <pre><code>&lt;% for (i in user) { %&gt;
          &lt;form action=&quot;/admin&quot; method=&quot;POST&quot;&gt;
              &lt;label for=&quot;checkbox&quot;&gt;&lt;%=user[i].name%&gt;&lt;/label&gt;
              &lt;input type=&quot;checkbox&quot; id=&quot;user&quot; name=&quot;user&quot;&gt;
          &lt;/form&gt;
      &lt;% } %&gt;
      &lt;button type=&quot;submit&quot;&gt;View Profile&lt;/button&gt;
  </code></pre>
  <p>however when I console log it says that user info is undefined.</p>
  <pre><code>router.post(&quot;/admin&quot;, (req, res) =&gt; {
      profile = req.body.name
      console.log(`user info: ${profile}`)
      res.redirect(&quot;/admin/userprofile&quot;)
  
      router.get(&quot;/admin/userProfile&quot;, ensureAuthenticated,(req, res) =&gt; {
         
          res.render(&quot;admin_user_profile&quot;, {
              user: profile
          })
      });
  })
  </code></pre>
  <p>any help will be greatly appreciated, thanks</p>