n.am n.am - 5 months ago 6
PHP Question

ID won't be sent to url

public function editVC(){
$currentUserID = $_GET['userID'];

$vaccineID = $_POST['vaccines'];
$ageID = $_POST['ages'];

if(VaccineModel::editDChildVC($vaccineID,$ageID,$dcomment,$currentUserID)) {
header('Location: https://autovaccines-peldorri.c9users.io/Classes/Views/viewChildVC.php?userID= $currentUserID');
} else {
echo $vaccineID;
echo $dcomment;
echo $currentUserID;
echo"cant add";

When it redirects, this is the resulted url


I can't seem to figure out why the variable won't be sent to the url, although I have tried echoing the variable
and it did echo the correct ID, this means the if condition applies and there is a value in the variable.


Variables don't expand inside single-quotes, use double-quotes, i.e.:

header("Location: https://autovaccines-peldorri.c9users.io/Classes/Views/viewChildVC.php?userID=$currentUserID");