Can someone explain me why when I execute this code multiple times it append the substring ?val=1
to my url?
Example: My script is located in index.php and if I execute it 3 times I will have this url in my browser: http://localhost/index.php?val=1?val=1?val=1
I would like to have http://localhost/index.php?val=1
. . .
<?php
if(isset($_POST['hidden']) && $_POST['hidden'] == 2){
$page = $_SERVER['HTTP_REFERER'];
header("location: $page?val=1");
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name ="hidden" value="2">
<input type="submit">
</form>