I've reconsidered, this will do what you want.
Just have the Javascript assign the forms action property to the page
where you collect the pin# and do something with it.
One nice thing about this code is, your pin# doesn't have to be just numbers. You can use any alpha or numeric value. And if you want pin codes larger or smaller than 4 digits then change the value from 4 to what ever you want in the if statement in the Javascript. And of course change it in the text before the input element.