I am a total novice in programming and on this website. I am working a page with php with password for access to another page. within the site, when doing the tests In Localhost it works well, but when I work with my server it does not redirect me to any page the complete code is:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Linkar 1</title>
<style>
* {
margin: 0;
padding: 0;
}
#caja0 {
font-family: sans-serif;
background: #E0E0E0;
width: 95%;
border-radius: 10px;
border: 2px solid red;
padding: 1%;
padding-bottom: 2%;
margin: 1% auto;
}
h3 {font-size: 1.5em;
text-align: center;
}
hr {
border: solid 2px red;
margin: 1em;
}
.rojo {
color: #FF0004;
font-weight: bold;
}
#verde{color: #09FF00;}
h1{
text-align:center;
}
table{
background-color:#FFC;
padding:25px;
border:#666 5px solid;
}
.no_validado{
font-size:18px;
color:#F00;
font-weight:bold;
}
.validado{
font-size:18px;
color:#0C3;
font-weight:bold;
}
</style>
</head>
<body>
<div id="caja0">
<h3>Linkar a otros sitios con contraseña</h3>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<table width="48%" align="center">
<tr>
<td>Pon contraseña:</td>
<td><label for="nombre_usuario"></label>
<input type="text" name="nombre_usuario" id="nombre_usuario">
</td>
</tr>
<tr>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="enviando" id="enviando" value="Enviar">
</td>
</tr>
</table>
</form>
<?php
/*Este código comprueba el envío del formulario*/
if(isset($_POST["enviando"])){
/*$_POST es una var Super Global y son Arrays y eso es lo que estamos haciendo con este formulario*/
/*Con estas var almacenamos lo que el usuario ha introducido en los cuadros de texto en caso de que pulse el botón de Enviar */
$usuario=$_POST["nombre_usuario"];
if($usuario=="Juan"){
//echo(" Puedes entrar ya");
/*Codigo para redirrecionar a otra pág dentro el sitio*/
header('Location: /Probando.html');
/*Codigo para redirrecionar a otra WEB*/
//header('Location:http://jpbenavente.com/index.html');
}else{ echo("No puedes entrar nunca");
}//Del 2º if
};//DEL iF
?>
</div>
</body>
</html>
Thanks for your help