Custom File - header location

HI all

I used to use the following code in Version 2019 to pull specific by users when logged in. The association was by iduser

here is the code that worked fine in 2019

<?php include_once "header.php" ?> <?php $a = CurrentUserID(); header("Location: my_sars_profileview.php?showdetail=&idusers=$a"); ?>

I am now getting stuck in regards to version 2021.
This is what i have:

<?php $a = CurrentUserID(); header("location: my_sars_profile2view/?showdetail=&idusers=$a}"); exit(); ?>

Any help with this would be greatly appreciated

CraigNel wrote:

header(“location: my_sars_profile2view/?showdetail=&idusers=$a}”);

You need to remove the extra “/” before “?”.

It is also better to include the base path and URL-encode the paramters, e.g.

header("location: " . GetUrl(“my_sars_profile2view”) . “?showdetail=&idusers=” . urlencode(‘$a}’));