Page 1 of 1

session and history.go(-1) don't work

Posted: Sun Jun 05, 2005 3:06 pm
by ranpaco
help please
-----------------------pagina1.php-------------------------
<?php
session_start();
if ($_POST['Accion'] == "Insert"){
echo "<script language=\"JavaScript\">";
echo "window.location = \"pagina2.php\";";
echo "</script>";
}
?>
<html>
<head>
</head>
<body>
<form name="form1" method="post" action="pagina1.php">
<input name="Accion" type="hidden" value="Insert">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
-----------------------pagina2.php-------------------------
<?php
session_start();
?>
<html>
<head>
</head>
<body>
<a href="javascript:window.history.go(-1)">forward</a>
</body>
</html>


ok, firt load pagina1.php and click in submit button, that load
Pagina2.php, now when I click in link forward the explorer
end me a error of page not found, whyyyy?????


I realy need you help, thank a lot.

Re: session and history.go(-1) don't work

Posted: Sun Jun 05, 2005 3:21 pm
by Roja
ranpaco wrote:ok, firt load pagina1.php and click in submit button, that load
Pagina2.php
No, your code doesn't.. it goes to pagina1.php:

Code: Select all

...
<form name="form1" method="post" action="pagina1.php">
...

Posted: Sun Jun 05, 2005 4:16 pm
by ranpaco
ok, see that:

if ($_POST['Accion'] == "Insert"){
echo "<script language=\"JavaScript\">";
echo "window.location = \"pagina2.php\";";
echo "</script>";
}

this lines redirect to pagina2.php

I know that this no have sense, but the original page has a lot more code that this.

Posted: Sun Jun 05, 2005 4:18 pm
by Roja
ranpaco wrote:ok, see that:

if ($_POST['Accion'] == "Insert"){
echo "<script language="JavaScript">";
echo "window.location = "pagina2.php";";
echo "</script>";
}

this lines redirect to pagina2.php

I know that this no have sense, but the original page has a lot more code that this.
Check and make sure that pagina1.php (after submit) is actually entering that code block.

Posted: Sun Jun 05, 2005 4:57 pm
by ranpaco
I'm really sure that pagina1.php after submit is entering to that code, because pagina2.php is load , the real problem is in pagina2.php when a try to return to pagina1.php doing a forward, when click in back page button on explorer or when call a javascript function window.history.go(-1).

thk a lot really

Posted: Mon Jun 06, 2005 10:22 am
by ranpaco
hey, please I really need help, maybe is wrong the way I use the session_star() ??? I don't know!!! somebody pleasee :(

Posted: Mon Jun 06, 2005 10:36 am
by malcolmboston
without the use of javascript...

Code: Select all

<?php
$url = "http://";
$url .= $_SERVER['HTTP_HOST'];
$url .= $_SERVER['REQUEST_URI'];
?>

Posted: Mon Jun 06, 2005 2:38 pm
by ranpaco
ok, problem solve
change the javascript for that:

Code: Select all

$url = &quote;http://&quote;;
$url .= $_SERVER&#1111;'HTTP_HOST'];
$url .= &quote;/&quote;.$_POST&#1111;'Accion'];
header('Location: '.$url);
thank for real help.