PDA

View Full Version : Trying to get my confirmation page to work


jag5311
1-8-02, 10:41 PM
I am using a form script that allows users on my site to submit a cheat to me. I am not sure if it is like formmail like all of you talk about, but it is what i am currently using. You can view the script here
http://dreamcatchersweb.com/scripts/

its called FORM RETURN

Well, with all of the variables set up, it takes you to a confirmation page once you have pressed the submit button here www.gamecubecheats.net/cheatcodes.shtml

Here is the confirmation page

www.gamecubecheats.net/cgi-bin/form.cgi

same thing if you press the submit button.

Now i have a particular confirmation page i would like to have setup instead of the one it provides. you can view the page i want here

www.gamecubecheats.net/confirm.htm

Here is the code from the form.cgi

# 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 for sending me your cheat request. Once reviewed, it will be updated onto Gamecube Cheats. </h1>\n");
print ("The information has been sent: Your submission is as follows:<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 <b>$backname</b></a><hr>\n");
print ("&copy; <a href=\"http://dreamcatchersweb.com/scripts/\">Dream Catchers Technologies, Inc.</a>\n");
print ("</body></html>\n");

exit;


How do i go about doing this. Or am i just better off using FORMMAIL. Does it have the options to form it into the layout of your particular page.

thanks

bryan

SimCoWeb
1-8-02, 11:51 PM
Honestly, Bryan, it's going to be very tricky for you to modify this script if you're not familiar with Perl. Inserting the HTML in the fashion that they have this configured requires some 'switches' to make sure that certain characters are 'disarmed'. For example, in front of each quotation mark there needs to be a '\' mark. And, since you're going to have a menu with plenty of links on this page then each one of those will need that in front of it or it renders the script inoperable.

All of your HTML for the page you want would have to be copied and pasted in that one area:

print ("Content-Type: text/html\n\n");
print ("<html><head><title>Thank You</title></head>\n");
print ("<body><h1>Thank You For for sending me your cheat request. Once reviewed, it will be updated onto Gamecube Cheats. </h1>\n");
print ("The information has been sent: Your submission is as follows:<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 <b>$backname</b></a><hr>\n");
print ("© <a href=\"http://dreamcatchersweb.com/scripts/\">Dream Catchers Technologies, Inc.</a>\n");
print ("</body></html>\n");

Obviously you wouldn't mess with the values area that shows the user's input. Just the area above that where the body tag starts. That's where you'd insert the majority of your HTML. Notice the numerous '\'s throughout.

Formmail is a very basic script but handles the job pretty easily and allows for a 'redirect' to your confirmation page. This script is generating the page on the fly which makes it much more difficult to customize.

Bud
1-9-02, 02:00 AM
jag5311, you can do the following to redirect the user to the page you want after they hit submit:

Place this just below the path to perl:
use CGI qw(:all);

Then replace everything between
"#Print Follow up HTML" and "exit;"

with:
print redirect (-url => "http://www.gamecubecheats.net/confirm.htm");

I'm attaching a copy of the changed script.

I didn't give it a trial run but it should work :)

~bud

jag5311
1-9-02, 02:07 AM
Cool, thanks. Do you know if there is any way to add something to this script, or get another script where if the user doesnt fill in certain fields, the confirmation page will tell them what they did wrong?

Bryan

jag5311
1-9-02, 02:16 AM
BUD

Yea it works thanks

Do you know how i can make it so the visitor can see teh contents of what was sent to me, kinda like what was on the old page. Before this change was made, if you were to type stuff in my form and then send it, the visitor would be taken to the confirmation page and shown what they typed in. I just don't know where that is printed in the form.cgi script.

If you think you can help, that would be great

Thanks

bryan

Bud
1-9-02, 04:52 PM
jag5311, glad it worked for you :)

As far as checking the form before submission (validating), it's best to use a little javascript to be sure all required fields are completed.

Since your form was very small, I went ahead and added the code for you, I'm attaching a copy of the changed shtml. I set it up so that all fields are required except the Webpage field. It will also place the user's cursor in the appropriate blank box after notifying them of the ommision ;)

Again, I didn't give it a test run so if it doesn't work let me know.

The only way I know to use the redirect I wrote (sending the user to the .shtml page) and have the new confirmation page show the info submitted would be to store the info in a database and write a ssi script that will pull the info from the database and display it on the confirmation page.

As an alternative, you could use the original code in the form.cgi and original confirmation page and add a "Continue" button (or link) that sends the user to the final confirmation page (the one you want to use). Just change the link that says "Back to" and replace it with "<h3>Continue</h3>" and replace the url "$backurl" with the url to the confirmation page. And change the part that says "The information has been sent and here is what you submitted" to "You have submitted the following information"..not the most straight forward way to do it though.

~bud

jag5311
1-9-02, 10:43 PM
Hey bud

Well, when i previewed the one you did in my browser, it worked. When i applied the same code in the <head></head> that you provided into my version of the cheatcodes.htm , and then i previewed it, it didn't work. so i don't know why

bryan

Bud
1-10-02, 02:45 AM
Hey bryan,

You'll also need to copy a piece of code from the form <form> tag, it looks like :

onSubmit="return validateIt()"


That should get it working.

~bud

jag5311
1-10-02, 04:19 AM
BAM, thanks alot Bud, youve been a real help

Bryan