<--html Template started-->
<html>
<head>
<title><TMPL_VAR name=TITLE></title>
</head>
<body>
<table align="center" border="1" bordercolor="#009999" cellspacing="0"
+>
<form name="index">
<TMPL_LOOP NAME=ROWS1>
<tr >
<td><input type="text" value="<TMPL_VAR NAME=Login>"/></td>
</tr>
<tr>
<td><input type="text" name="JDate" value="<TMPL_VAR NAME=JoinDate>"/>
+</td>
</tr>
<tr>
<td><select name="Mentor_dept_list">
<option value="selected">-- SELECT --</option>
<!-- This loop is not working-->
<TMPL_LOOP NAME=ROWSk>
<OPTION><TMPL_VAR NAME=DepartmentName></OPTION>
</TMPL_LOOP>
<!-- This loop is not working-->
</select></td>
</tr>
</TMPL_LOOP>
<tr>
<td colspan="2" align="center"><input type="submit" /><input type="res
+et"/></td>
</tr>
</form>
</table>
</body>
</html>
<--html template finish-->
<--perl code-->
#!/grid/common/pkgs/perl/v5.8.0/bin/perl -w
use CGI;
use DBI qw(:sql_types);
use HTML::Template;
my $cgi = CGI->new;
#my @tmpl_opts = (cache => 1, die_on_bad_params => 0, associate => $cg
+i);
my $template = HTML::Template->new(filename => 'addmodify.tpl');
my $dbh = DBI->connect('dbi:mysql:mentorship', 'pmweb', '');
#################################################################
########## FETCHING THE DEPARTMENT NAMES
#################################################################
my $sth = $dbh->prepare('select distinct departmentName from tbl_depar
+tment_names');
my($departmentName);
$sth->execute;
$sth->bind_columns(\($departmentName));
my @rows;
while($sth->fetch)
{
push @rows, {DepartmentName => $departmentName};
}
######################################################
########## DEPARTMENT NAMES FETCHING ENDED ##
######################################################
my $sth1 = $dbh->prepare('select mentee_login , date_of_join from tbl_
+mentee_details where mentee_login="urmil"');
my ($login,$joindate);
$sth1->execute;
$sth1->bind_columns(\($login,$joindate));
my @rows1;
while($sth1->fetch)
{
push @rows1, {Login => $login,JoinDate => $joindate,ROWSk=>\@row
+s };
}
######################################################
####Selecting the Status of mentee for the Template
######################################################
$template->param({ TITLE=>'Mentorship System', ROWSk=>\@rows, ROWS1=>\
+@rows1});
print "Content-Type: text/html\n\n", $template->output;
<!--perl code-->
|