I'm setting up a form in ASP classic and it will reload after submission (action self)
But this time it shows results of previous submissions, so how can I check that a POST submission has been made?
Like in PHP:
if($_POST['submit']) {
show results...
}
You have several options:
Method 1 - Check the request method:
Method 2 - add a hidden field to your form with a value then check if that value has been posted:
Method 3 - Check if the request.form collection contains items:
Method 4 - Post to a querystring (i.e. set
action
of<form>
to?post=yes
)Which one to pick?
My preferred option is method 4 – as it’s easily visible in the address bar as to what’s going on – if for some reason I want to avoid presenting this level of detail in the url, I tend to use option 3 as it’s easy to implement, requires no changes on the source forms & is reliable. As for the other two methods: