PDA

View Full Version : Redirect to a new 'Thanks page'..



woody
March 21st, 2001, 18:57
Does anyone know how I would redirect this form to mail script to a 'Thankyou for filling out this form..etc' HTML page other than the 'default' one suppled with the script?
ie: on another server.
The 'back url' at the top of the script only provides a link on the 'default page'
Here's my trusty script..


#!/usr/bin/perl

############################################################ ##########
# BEFORE TRYING TO EDIT THIS SCRIPT, READ THE README FILE
############################################################ ##########
#
# The Dream Catcher's Web Free CGI Scripts
# Form Return
# Created by Seth Leonard
#
# http://dreamcatchersweb.com/scripts/
#
# (c)2000 Seth Leonard
# All Rights Reserved
#
############################################################ ##########
# ONLY EDIT THIS PART OF THE SCRIPT!!!!

$backurl = "http://perso.wanadoo.es/woodywyatt/";
$backname = "Your Home Page Title";
$mailprog = '/var/qmail/bin/qmail-inject';
$youmail = 'woodywyatt@wanadoo.com';

# DO NOT EDIT BELOW THIS LINE!!!!
############################################################ #####

read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});

open (MAIL, "|$mailprog $youmail") || die "Can't open $mailprog!\n";
print MAIL ("To: $youmail\n");
print MAIL ("From: Internet User\n");
print MAIL ("Subject: Form Response\n\n");

# Process info from Fill in Form

@namevalues = split(/&/, $namevalues);
foreach $namevalue (@namevalues) {
($name, $value) = split(/=/, $namevalue);
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$INPUT{$name} = $value;
unless ($value eq "") {
print MAIL ("$name: $value\n");
}
}

close (MAIL);

# Print Follow up HTML

print ("Content-Type: text/html\n\n");
print ("<html><head><title>Thank You</title></head>\n");
print ("<body><h1>Thank You For Filling in the Requested Information</h1>\n");
print ("The information has been sent and here is what you submitted:<hr>\n");

foreach $namevalue (@namevalues) {
($name, $value) = split(/=/, $namevalue);
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$INPUT{$name} = $value;
unless ($value eq "") {
print ("$name: $value<br>\n");
}
}

print ("<hr>\n");
print ("<a href=\"$backurl\">Back to $backname</a><hr>\n");
print ("&copy; <a href=\"http://dreamcatchersweb.com/scripts/\">Dream Catchers Technologies, Inc.</a>\n");
print ("</body></html>\n");

exit;

Epgs
March 21st, 2001, 19:14
it would be something after this
# Print Follow up HTML

it would be like refresh="http://whatever.whatever"

something like that (whatever the refresh command is

woody
March 21st, 2001, 19:34
Thanks for the swift reply. But I still can't get this f.thing to work. I'm not quite sure where I should be inserting the extra line of code (refresh).
Please excuse I'm new to this.

is0lized
March 21st, 2001, 20:33
use this after yoru form action on your HTML doc

<input type=hidden name="redirect" value="http://">

Koolguy
March 21st, 2001, 23:43
header("Location:http://www.somesite.com/somepage.htm");

i think this is it

woody
March 22nd, 2001, 05:06
Nope tried that (unless I've inserted it in the wrong place).
Any other ideas?