Make the forum submit to it self.
Lets say the page is index.php.
Then let the form-tag look like this:
<form name="myForm" action="index.php" method="post">
then
<input name="username" type="text" value="<?php print($HTTP_POST_VARS["username"]); ?>">
and instead of using document.location.href...
use "document.myForm.submit()" instead!
I hope you understand 😉
/Staffan