Am 3 pagini (tab-uri) intr-o singura pagina, in pagina 2 din cele 3 am un form post, problema este dupa revenire inapoi mă redirectează tot pe pagina 1 in loc de pagina 2, am incercat si cu window.history.back(); si fara succes.
Exită oare o soluție sau va trebui sa fac pagini separate?
Cod: Selectaţi tot
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<style>
#pas_continua {
position: relative;
margin-left:0;
top:0;
}
div#pas_continua button.sg-current {
border:0.1em solid;
}
.sg-tab-content {
display: none;
}
</style>
</head>
<body>
<div id="box-a">
<div class="pas_continua">
<button class="tablinks" onclick="openTab(event, 'pasul-1','box-a')" id="default">Pasul 1</button>
<button class="tablinks" onclick="openTab(event, 'pasul-2','box-a')">Pasul 2</button>
<button class="tablinks" onclick="openTab(event, 'pasul-3','box-a')">Pasul 3</button>
<!-- <div class="spacer"></div>-->
</div>
<div id="pasul-1" class="sg-tab-content">
PAGINA 1
</div>
<div id="pasul-2" class="sg-tab-content">
<form method="post" action="pagini/pg_2.php">
</form>
PAGINA 2
</div>
<div id="pasul-3" class="sg-tab-content">
PAGINA 3
</div>
</div>
<script>
document.getElementById("default").click();
function openTab(evt, tabName, boxName) {
var i, tabcontent, tablinks;
var box = document.getElementById(boxName)
tabcontent = box.getElementsByClassName("sg-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = box.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" sg-current", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " sg-current";
}
</script>
</body>
</html>