Is there a function I can attach as a click event of a button to make the browser go back to previous page?
<input name="action" type="submit" value="Cancel"/>
Add this in your input element
<input
action="action"
onclick="window.history.go(-1); return false;"
type="submit"
value="Cancel"
/>