Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =======================
- HTML
- =======================
- <form class="form-wrapper" method="POST" action="/form">
- <div class="form-group">
- <label for="exampleInputEmail1">Email address</label>
- <input type="email" class="form-control" name="email" id="exampleInputEmail1" aria-describedby="emailHelp"
- placeholder="Enter email">
- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
- </div>
- <div class="form-group">
- <label for="exampleInputPassword1">Password</label>
- <input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
- </div>
- <div class="form-group form-check">
- <input type="checkbox" name="checkbox" class="form-check-input" id="exampleCheck1">
- <label class="form-check-label" for="exampleCheck1">Check me out</label>
- </div>
- <button type="submit" class="btn btn-primary">Submit</button>
- </form>
- <hr>
- <div class="user">
- <p>Email: <%= email %></p>
- <p>Password: <%= password %></p>
- <p>Checkbox: <%= checkbox %></p>
- </div>
- =====================
- NODE.JS (EXPRESS)
- =====================
- app.post('/form', urlencodedParser, (req, res) => {
- res.render('index', {
- page: 'Form Page.',
- email: req.body.email,
- password: req.body.password,
- checkbox: req.body.checkbox
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement