1

I have an external forum login form on my website but after logging in I would like users to redirect back to the exact website page that the visitor was looking at before logging in.

The thing I use:

<script>
function goBack()
{
window.history.go(-1)
}
</script>

<form action="./forum/ucp.php?mode=login" method="post">
<fieldset>
<label for="username">Name:</label><br>
<input type="text" name="username" id="username" size="20" class="input"><br>
<label for="password">Password:</label><br>
<input type="password" name="password" id="password" size="20" class="input"><br>
<label for="autologin">Remember<input type="checkbox" name="autologin" id="autologin"></label><br>
<input type="hidden" name="redirect" value="goBack()">
<input type="submit" name="login" value="Log in" class="button">
</fieldset>
</form>

However, the browser redirects to:

http://www.mysite.com/forum/goBack()?sid=87b53e6ecb0ae9062a3a9b930

I only manage to redirect to the index of my website:

value="http://www.wow.com">

Who will help me out :)?

4

1 に答える 1

0

このコードに従うことができます:

<?php
//perform your post operations
if(isset($_POST['submit'])){
echo "<pre>";
print_r($_POST);
?>
<script>
window.history.go(-2); // -1 will post on the page from which it has been posted
</script>
<?php
    }
    ?>
    <html>
    <body>
    <form id="myForm" name="myForm" method="post">
    Name: <input type="text" name="name" id="fname">
    Email <input type="text" name="email" id="emailid">
    <input type="submit" name="submit" value="Submit" id="submit">
    </form>
    </body>
    </html>
于 2012-12-06T12:25:42.660 に答える