Forum Moderators: coopster & phranque

Message Too Old, No Replies

Redirect form in formmail.pl

         

charger9

8:35 pm on Jan 22, 2008 (gmt 0)

10+ Year Member



I don't know much about writing code, but I have a template of a formmail.pl file that I have been able to tinker with and make my forms email. There is a standard ugly "thank you" page that appears after submission. I'm trying to redirect it to an already created "thank you" page. The code behind that page is:

sub good_app {
print "Content-type: text\/html\n\n";
print "<html><head><title>Thank you<\/title><\/head>\n";
print "<body><p><h2>Thank you for completing our survey.<\/h2><\/p><\/body><\/html>\n";
}

I think it's something with the way my formmail.pl file is coded, but I don't know the code to understand how to change it.

Any suggestions?

phranque

2:28 am on Jan 23, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], charger9!

you should replace the "thank you page" output in your mail script with a "Location: " HTTP response header that points to your custom thank you page.

perl_diver

8:31 am on Jan 23, 2008 (gmt 0)

10+ Year Member



just to expand on that:


sub good_app {
print "Location: http://www.example.com/thanks.html\n\n";
}

phranque

8:52 am on Jan 23, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



yes, and the header syntax is strict.

charger9

2:55 pm on Jan 23, 2008 (gmt 0)

10+ Year Member



Works perfectly. Thanks for your help!