NodeJs Express display form search results

I hope someone can understand my question and offer some help. I am creating a Flight Booking application with Amadeus APIs. I have a flight search form on the index page with hbs template engine.

The form submits to /auth/flights for processing. I then want to display all error in index page (if there are any).

But the problem is that, maybe due wrong linking, I can't get the form to display all errors back to the index page. I will display my code below so that you can see what I mean.

//flight search form in index.hbs

    <form action="/auth/flights" method="post">
      input details here
    </form>

//in server.js
app.use('/',require('./routes/pages');
app.use('/auth',require('./routes/auth');


//auth.js @ routes/auth
const express = require('express');
const router = express.Router();
const authController = require('../controllers/auth');

router.post('/',authController.flights);
module.exports = router;

//in auth.js @ controllers/auth
exports.flights = function(req,res){
  const {location,destination,depart} = req.body;

  if(!location || !destination || !depart){
  res.status(404).render('/',{error:'Fields marked are required'});
 }
}

My problem is that, I can't reload the index page. I will be happy if someone can offer some advice

Trying to get username to display in the url

I am trying to get the usernames of users to appear in the url so that I can use $_GET['username'] to grab the username to create a link to the user's profile which can be viewed by any logged in user. So far I can only the logged in user's username to display in url.

So I did a loop/queried the database and selected usernames of all users and created a link of the usernames to appear in the url. So any logged in user can go to the users.php and click on any username to see the detailed information of that user. Only logged in users will be able to access the profile.php and users.php.

So far this is what I have

session_start();

  include 'includes/dbh.php';
  $sql = "SELECT * FROM users";
  $query = $conn->query($sql);
  $num = $query->num_rows;
  if($num > 0){
      while($row = $query->fetch_assoc()){
        $users[]= $row;
          foreach($users as $user){
                $usersUsername = $user['usersUsername'];
                echo '<a href="profile.php?user="'.$usersUsername.'">'.$usersUsername.'</a><br>';
          }     
      }
  }

But the url appears in the browser like this: http://localhost/object/profile.php?user=
I need it be something like http://localhost/object/profile.php?user=nanakumi75
The username is missing. I need some help here