Page 1 of 1

echoing javascript location.replace(URL) from php

Posted: Thu Nov 26, 2009 11:13 pm
by binod
Dear all,
here is what I have
HTML
------
<?php ?>
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="/javascript/validate.js"></script></head>
<body>
<form name="form" action="/process/process_login.php" onsubmit="return validate(this)" method="post">
<input type="text" name="username" id="username" maxlength="100">
<input type="password" name="password" id="password" maxlength="32">
</form> </body> </html>

PHP
----
<?php
if(isset($_POST['submit']))
{
// do the processing
}
else
{
echo "<script type='text/javascript'> \n";
echo "location.replace('pages/error.php') \n";
echo "</script>";
}
?>

Right here, the location.replace is not working. I can get to the error.php page but the back button is still enabled.
Help me please, I'm desperate.

Re: echoing javascript location.replace(URL) from php

Posted: Thu Nov 26, 2009 11:19 pm
by manojsemwal1
use below script to come back

?>

echo "<script>window.navigate('studycenterdetail.php')</script>";
exit();

</script>
<?php