473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ


Templates Code

By Blair Ireland
Senior Editor, TheScripts.com

Now you've made it to the sea of if/elsif and else statements. What are they there for? These just control the actions the script takes according to variables sent to it. Pretty basic programming here, so we will skip over that part.

The next two sub routines are rather simple, no real work being done. They just basically help you make the template for the script. The $title = shift; line in sub header is rather important, as each call of this subroutine provides it with a 'Title' for the page. This line makes sure it receives this title in the $title variable, to be printed.

sub header {
   $title = shift;
   print qq~
 <HTML>
 <HEAD>
 <TITLE> $title </TITLE>
 <basefont face="Trebuchet MS,Arial,Helvetica" size="2">
 </HEAD>
 <BODY bgcolor="#FFFFFF">
 <CENTER>
   ~;
   }
   
   sub footer {
   print qq~
 <TABLE border=0 cellspacing=3 cellpadding=3>
 <TR>
     <TD>
         <a href="database.cgi?action=addrecord"><FONT COLOR="#000000" size=-1>Add A Record</a>
     </TD>
     <TD>
         <a href="database.cgi?action=edit"><FONT COLOR="#000000" size=-1>Modify a Record
     </TD>
     <TD>
         <a href="database.cgi?action=delete"><FONT COLOR="#000000" size=-1>Delete a Record
     </TD>
     <TD>
         <a href="database.cgi?action=search"><FONT COLOR="#000000" size=-1>Search
     </TD>
 </TR>
 </TABLE>
 </CENTER>
 </BODY>
 </HTML>
   ~;
   }

Ok, now that the easy stuff is out of the way, time to start with some of the database sub routines.

« Perl Database Program Adding Records Part 1 »

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.