0

The logic is simple: user fills in the form, presses submit and data from form is sent with POST method to a cgi script (let's call it mail.pl), which extracts them and uses somehow; it doesn't really matter how exactly.

What I need is to show a box with "Your message has been sent. Press a button or wait 5 seconds to return.". And after 5 seconds redirect to index.html. But I'm afraid I don't know how to do it. I can print html code with print operator, but how do I make it redirect back to index, when all headers has already been sent at the beginning of the script?

Is it ever possible to do it with perl and cgi, or I have to use javascript or something else?

Ivan
  • 163
  • 1
  • 12

1 Answers1

2

Yay, Perl + CGI!

I'd use (print) a Meta refresh tag. From Wikipedia:

<meta http-equiv="refresh" content="5; url=http://example.com/">
sshaw
  • 994
  • 6
  • 10
  • This is strange: it just refreshes the page with the "Mail sent." message each 3 seconds. It doesn't actually redirects. I can see it in apache logs: (tried to insert log entry, but is seems markup doesn't work in comments :) ). – Ivan May 17 '14 at 17:23
  • [17/May/2014:21:29:24 +0400] "GET /mail.pl HTTP/1.1 -- why does it send GET request of mail.pl while it should send it to the address, specified in url parametr? – Ivan May 17 '14 at 18:24
  • Can you add the meta tag you're generating and include the URLs involved? – sshaw May 17 '14 at 20:46
  • `` I don't have domain name for now. – Ivan May 17 '14 at 21:15