in reply to how to go back to previous page.

If you are trying to control the browser, the best you are going to do is use the history object. Something like..
<FORM> <INPUT TYPE="button" VALUE="Back" onClick="history.go(-1)"> </FORM>
In perl, you can do a header Location: redirect to whatever the logical last page was. i.e. if you have a 2.cgi, you can send a Location: 1.cgi to the browser instead if they submit with certain values.