| | |
Proper Setup?
![]() |
•
•
Join Date: Sep 2005
Posts: 175
Reputation:
Solved Threads: 0
I'm trying to access a cgi script when a form is submitted. With that script, I want to display a page that basically says, "Is this info correct?" and show them what they entered. Then, if they hit "Yes", I want to send an email to myself with their info. If no, I want it to go back to the previous page. I'm not sure how to do this. I'm stuck after creating the confirmation page. Here's what I have so far:
Perl Syntax (Toggle Plain Text)
#!/usr/bin/perl #confirmSubscribe.cgi print "Content-type: text/html\n\n"; use CGI qw(:standard); use Mail::Sendmail; use strict; #var declarations my ($firstName, $lastName, $email, $street, $city, $state, $zip, $msg, %mail); #var values $firstName = param('firstName'); $lastName = param('lastName'); $email = param('email'); $street = param('street'); $city = param('city'); $state = param('state'); $zip = param('zip'); #create page sub send print header; print <<endHtml; <html> <head> <title>Please confirm your information</title> <body> <p> </p> <p> </p> <p> </p> <p align="center" /><h2>Please confirm your information:</h2></p> <p><font size="4" face="Arial">$firstName $lastName<br /> $email<br /> $street<br /> $city, $state $zip</font></p><br /><br /> <form method="post" action="http://www.sgnscoops.com/Magazines/magazineMain.html"> <input type="submit" value="Yes, it's correct."> </form><form method="link" action="http://www.sgnscoops.com/cgi-bin/subscriptionSent.cgi"> <input type="button" value="No, I made a mistake."> </form> </body> </html> endHtml
Be what you is, don't be what you ain't.
Cause if you ain't what you is, you is what you ain't!
Cause if you ain't what you is, you is what you ain't!
And... what? You want us to write the rest for you?
Chaos
Lost Souls: text based RPG
MUDseek: MUD gaming search
Lost Souls: text based RPG
MUDseek: MUD gaming search
•
•
Join Date: May 2008
Posts: 46
Reputation:
Solved Threads: 2
no curly braces after sub send.
send() is never called in the main body of the cgi.
Perl Syntax (Toggle Plain Text)
sub send() { #code }
send() is never called in the main body of the cgi.
Last edited by Major Major; Jul 29th, 2008 at 4:48 pm. Reason: typo
...well, okay. If we're actually going to try to critique. Um... nothing whatsoever in the script actually attempts to send an email.
That's kinda the root of my earlier comment. The whole thing isn't even a framework of what's described as the objective; it's a non-functional beginning of some of it. So it seems like the OP isn't asking for debugging assistance or critique so much as to have the rest of his script (his homework?) written for him.
That's kinda the root of my earlier comment. The whole thing isn't even a framework of what's described as the objective; it's a non-functional beginning of some of it. So it seems like the OP isn't asking for debugging assistance or critique so much as to have the rest of his script (his homework?) written for him.
Chaos
Lost Souls: text based RPG
MUDseek: MUD gaming search
Lost Souls: text based RPG
MUDseek: MUD gaming search
•
•
Join Date: May 2008
Posts: 46
Reputation:
Solved Threads: 2
•
•
•
•
...well, okay. If we're actually going to try to critique. Um... nothing whatsoever in the script actually attempts to send an email.
That's kinda the root of my earlier comment. The whole thing isn't even a framework of what's described as the objective; it's a non-functional beginning of some of it. So it seems like the OP isn't asking for debugging assistance or critique so much as to have the rest of his script (his homework?) written for him.
Yeah but notice that in the <form> action, different pages are being called as the action, likely the email is being dealt with there. Although I think that the actions are reversed. It makes more sense that Yes should go to the subscriptionSent.cgi and No should go back to the HTML page where the info was entered to begin with.
Perl Syntax (Toggle Plain Text)
<form method="post" action="http://www.sgnscoops.com/Magazines/magazineMain.html"> <input type="submit" value="Yes, it's correct."> </form><form method="link" action="http://www.sgnscoops.com/cgi-bin/subscriptionSent.cgi"> <input type="button" value="No, I made a mistake."> </form>
Okay, fair enough.
OP, would you care to post the other scripts this one is referring to?
OP, would you care to post the other scripts this one is referring to?
Chaos
Lost Souls: text based RPG
MUDseek: MUD gaming search
Lost Souls: text based RPG
MUDseek: MUD gaming search
You should use one script to handle the entire process. But, writing CGI scripts is not a good idea for a person that seems to not have any experience and probably does not understand even the basics of writing secure CGI scripts. I suggest you hire a programmer, one that can demonstrate that they can write a secure CGI script. A script like this should not cost very much. You can post jobs on many websites and take bids from programmers.
I agree that processes like this should be written in one script. People always get too hung up on the 'page' paradigm and break processes across scripts in a way that just doesn't help anything.
But, erm, not for nothin'... but how would this guy actually know if a programmer had demonstrated an ability to write a secure CGI script or not?
But, erm, not for nothin'... but how would this guy actually know if a programmer had demonstrated an ability to write a secure CGI script or not?
Chaos
Lost Souls: text based RPG
MUDseek: MUD gaming search
Lost Souls: text based RPG
MUDseek: MUD gaming search
Ask for references, read comments from previous customers, have their work reviewed by a third party. It would still be possible to be fooled but many of the hire-a-programmer sites do a good job of hooking up customers with good programmers.
They can always try and hack/crack the script to see what happens under various conditions, which is the acid test of any CGI script.
They can always try and hack/crack the script to see what happens under various conditions, which is the acid test of any CGI script.
•
•
Join Date: Sep 2005
Posts: 175
Reputation:
Solved Threads: 0
First of all, it is not homework. I'm trying to learn Perl. No one is an ace when they first start learning something. I don't want anyone to write the script for me: I wouldn't learn anything that way.
Major, I did accidentaly have the links switched around for the buttons. Also, the "sub send" I forgot to delete before I posted the code.
Chaos, I didn't attempt the email portion yet because I want to make sure that I set it up correctly before doing so.
When "Yes" is clicked, can I just send an email then, or do I need to have another CGI script perform this?
Major, I did accidentaly have the links switched around for the buttons. Also, the "sub send" I forgot to delete before I posted the code.
Chaos, I didn't attempt the email portion yet because I want to make sure that I set it up correctly before doing so.
When "Yes" is clicked, can I just send an email then, or do I need to have another CGI script perform this?
Be what you is, don't be what you ain't.
Cause if you ain't what you is, you is what you ain't!
Cause if you ain't what you is, you is what you ain't!
![]() |
Similar Threads
- Won't load Windows Setup (Windows NT / 2000 / XP)
- Page not giving proper output (Perl)
- Suse 10.2 fails to boot after proper installation of ndiswrapper and drivers (*nix Hardware Configuration)
- Computer, Router, Cable Modem communication (noob network setup problems) (Networking Hardware Configuration)
- Linux and Windows networking together... is it a pipedream? (Getting Started and Choosing a Distro)
- setup dual boot xp and fedora core 1 (*nix Software)
- Windows Nt Won't Load (Windows NT / 2000 / XP)
Other Threads in the Perl Forum
- Previous Thread: Script to Remove duplicate lines from a text file.
- Next Thread: What's wrong with this perl error
| Thread Tools | Search this Thread |





