Quick ASP Question - calling the page without specifying its name.

When I write ASP pages with forms in them I always submit the form to the same page rather than a new page, and then include some code in the page to respond when data has been passed.
I am accustomed to pasing form information to the page by naming it (I don’t know any better) such as

(in page.asp)

“<form method=“get” action=“page.asp”>”
Is there a tidy way to say, in ASP - "I want to pass this information to ‘myself’ "

I ask because if I ever want to write a new version of a page I make a copy of the existing page, and then rename it - I often fall fowl of forgetting to alter the from line! so my modified page passes form data to the original page. If it’s passing to ‘this’ or ‘myself’ regardless of what ‘this’ is that would not be a problem

I have worked out the answer to my own question…

Just leave the ‘action’ bit blank. :smiley:

For future reference you can use the variable Request.ServerVariables(“SCRIPT_NAME”). If you write that out as the form action, that might be a more cross-browser compliant than leaving the action blank.



<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>">


Thanks :slight_smile: Even though my intended audience is my own colleagues who all use current IE I like to do things properly so I will remember this.

Also you have sort of re-inforced the knowledge of how to include ASP script in such a narrow space (by adding the ‘=’) I’ve had problems due to not knowing this in the past.
I love and thank the SDMB (And specifically you ZipperJJ for constant ASP and SQL help. And recently chrisk for opening up a new world of possibilites by expanding my knowledge of the power of the case statement in sql. I have solved a multitude or problems recently by creative use of case in both the select area and the group by area) for being a fantastic source of free advanced-level education.

The internet is good for that, but the internet invariably gives you useless and misleading answers. The SDMB is a resource you can ask questions of varying complexity and get correct answers nearly every time.