una variante a $_POST son las sessiones ahi no vas a tener problemas al refrescar
index.php
Código php:
Ver originalif(isset($_SESSION['p'])){ include ($_SESSION['p']);
unset($_SESSION['p']); // borramos la variable de session }else{
include ('home.html');
}
send.php
Código php:
Ver original<?php
if(isset($_POST['pagina'])){ $_SESSION['p'] = $_POST['pagina'];
header('location: index.php'); }
?>
home.html
Código html:
Ver original function post_to_url(path, pagina, method) {
// puedes definir el path o dar la opcion de elegir a donde se envia
//path = "index.php";
method = method || "post";
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name",'pagina');
hiddenField.setAttribute("value", pagina);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
}
<a href="#" name="usuarios" onclick="post_to_url('send.php','usuarios.php','post')" >usuarios
</a> <a href="#" name="usuarios" onclick="post_to_url('send.php','noticias.php','post')" >noticias
</a>
con esto cuando refresques el index.php va a mostrarte el contenido de home.html nuevamente