I made a PHP code to add a list of buttons on my website, but it doesn't work, it doesn't update the number and stays on the same integer
I already tried modifying the code and changing some things.
<?php
$capnum1 = 1;
$capbtn = '<a href="#cap'.$capnum1.'"><button class="w3-btn bg" onclick="openCity('."cap".$capnum1."'".')">'.$capnum1."</button></a>";
$capbtn2 = '<a href="#cap'. $capnum1++ . '"><button class="w3-btn bg" onclick="openCity('."cap". $capnum1++ ."'".')">'. $capnum1++ ."</button></a>";
echo $capbtn;
while($capnum1 <= 5){
$capnum1++;
echo $capbtn;
}
?>
I expected it to be 1,2,3,4,5 but it was 1,1,1