CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
I DID IT!!!!

 



SirAnvil
Deleted

Dec 16, 2000, 8:26 PM

Post #1 of 3 (243 views)
I DID IT!!!! Can't Post

Thank you Slueth.

Here it is. My first perl script that works!!!!
Just remember, it's my first

#!/usr/bin/perl
use diagnostics;
use CGI;

#cgiobject= new CGI;
$q = new CGI;
$first=$q->escapeHTML( $q->param('first_name'));
$last=$q->escapeHTML( $q->param('last_name'));
$mail=$q->escapeHTML( $q->param('mail'));

#race=$cgiobject->param("race");

open(DATA, "mydata.txt");
@text=<DATA>;
close(DATA);

open(DATA, ">mydata.txt") or die ("Can't creat myfile.txt");
print DATA "<blockquote><b>Name: </b>$first $last\n";
print DATA "
<b>E-Mail:</b> <a href=\"mailto:$mail\">$mail
</a>\n";
print DATA "<img
src=\"http://www.christiangamers.org/goldenic.gif\">
\n";
print DATA "</blockquote>";
print DATA @text;
close(DATA);
open(FINAL, "mydata.txt");
@newdata=<FINAL>;
close(FINAL);

open (HTML, ">guestbook.html");
print HTML "<HTML>\n<body bgcolor=\"black\" text=\"white\">\n<FORM
METHOD=POST
ACTION=\"http://alpha.jaxcan.org/~cgronline/temp/guestbook.cgi\">\n Enter
Your First Name:<BR>\n <input name=first_name><BR>\n Enter Your Last
Name:<BR>\n <input name=last_name><BR>\n Enter Your E-mail:<BR>\n <input
name=mail><BR>\n <P>\n <input type=submit value=Finished><BR><BR>\n";
print HTML @newdata;
close(HTML);
print "Location: guestbook.html\n\n";

---Watcha Think?




sleuth
Enthusiast

Dec 16, 2000, 10:42 PM

Post #2 of 3 (238 views)
Re: I DID IT!!!! [In reply to] Can't Post

 It looks good...

Sleuth



zanardi
journeyman

Dec 17, 2000, 12:26 PM

Post #3 of 3 (230 views)
Re: I DID IT!!!! [In reply to] Can't Post

open(DATA, ">mydata.txt") or die ("Can't creat myfile.txt");

Spelled create wrong ;)

Personally. When I open/write/close files I use the $! variable

open(F,"path/to") or die $!;

But it's all a personal preference I guess

My BBS

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives