OK, the code will be something like:
#!/usr/bin/perl
use strict;
use CGI;
my $cgi = new CGI;
# construct and send confirmation emails here if you
# want them to go to everyone
if ($cgi->param('radiobutton') eq 'paypal')
{
# this sends a redirection header
print $cgi->redirect('http://sendmetopaypal.com');
}
else
{
# construct and send confirmation emails here if you
# only want them to go to non paypal users
print $cgi->header(),
$cgi->start_html,
"Thank you for booking, a confirmation email has been sent to
+email\@address",
$cgi->end_html;
}
What I meant by 'has to be the first header' is don't do this:
#!/usr/bin/perl
use strict;
use CGI;
my $cgi = new CGI;
print $cgi->header;
print $cgi->redirect('http://redirecttohere.com');
I've got stuck on that one a couple of times :-)
In other words, don't forget that redirect is a header in it's own right - it doesn't need a $cgi->header sending before it.
|