However I want the script to redirect to the page it submitted from rather than a predefined url as the script will be on thousands of pages, so I cannot manually add the url each time.
Currently I am just using the simple:
<input type=hidden name="redirect" value="mydomain/mypage.shtml">
Also I would like if possible to create a pop up on submit to say thanks.
Any ideas?
Here's one way it could be done:
1. encode link to "form generator" script in desired pages, (or in script if pages are dynamic).
2. user clicks link, Perl script generates form on the fly with $ENV('HTTP_REFERER') stuffed in a hidden field. (This will be passed back one more time so user can be returned to original page when form submission is complete).
3. User complete form and clicks submit.
4. Form data is sent to script (which has javascript coded into it that performs the pop-up "thank you" window). Users clicks "Close Window" which, via Javascript returns them to original page (which the script has been passing as HIDDEN data since the first click).
Another way it could be done is with IFRAME or FRAME tags... that way you could direct the desired actions to happen in named portions of the screen.