Access a variable on a Site tab from within a Page

You are getting the “cannot find field name” error, because you do not have previousPageURL defined on the page with the form. You need to first retrieve the url of the previous page from storage, and you can then use it to set the input element on the page. You need something like this on the page with the form:

$w.onReady(function() {
   let previousPageURL = session.getItem("page");
   $w("#input6").value = previousPageURL;
});