---------------------------------------------------------------#!/usr/local/bin/perl -w our $html = ""; our $htmln = ""; $html =<<EOF; Content-Type: text/html\n\n <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:// +www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <TITLE> Forms-Search </TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" +ALINK="#FF0000"> <hr> EOF $htmln =<<EOF; <hr> <FORM ACTION="forms_rpt.cgi" METHOD="post" TARGET="_self"> <table width: 60% border="0" cellpadding="2" cellspacing="2"> <tr> <td>Form:</td> <td><input maxlength="10" size="10" name="fname"></td> </tr> <tr> <td>Title:</td> <td><input maxlength="10" size="10" name="form_title"></td> </tr> <tr> <td>Form Type:</td> <td align="left"> <select name="form_type"> <option value="all" selected>All</option> <option value="frl">FormFlow</option> <option value="xfdl">IBM WorkForms</option> <option value="xsn">Infopath</option>s <option value="pdf">PDF</option> <option value="jtp">JetForm</option> <option value="xfdl">Pureedge</option> <option value="doc">Word Document</option> </select> </td> </tr> </table> <br> <br> <br><br> <input type="submit" name="Submit" value="Submit"> </FORM> <HR> <P><SMALL>Created on ... April 01, 2006</SMALL></P> EOF $html .= $htmln; $htmln =<<EOF; </html></body> EOF $html .= $htmln; print $html;
#!/usr/local/bin/perl -w use CGI; # load CGI routines use DBI; use DBD::ODBC; my $cweb = CGI->new(); my $fname = $cweb->param('fname'); my $form_title = $cweb->param('form_title'); my $form_type = $cweb->param('form_type'); my $driver = "mysql"; my $server = "localhost"; my $database = "train"; my $url = "DBI:$driver:$database:$server"; my $user = ""; #--- taken out intentionally my $password = ""; #--- taken out intentionally our $db1 = DBI->connect( $url, $user, $password ) or die "Failure!\n"; our $html = ""; our $htmln = ""; our $hdr = 0; $html =<<EOF; Content-Type: text/html\n\n <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:// +www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <TITLE>Forms-Search Results</TITLE> <LINK REV="made" HREF="mailto:jarrell_dunson@ky.ngb.army.mil"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" +ALINK="#FF0000"> <hr> EOF #---------------------- test printout only $htmln = <<EOF; <hr> $fname<br> $form_title<br> $form_type<br> EOF $html .= $htmln; our %s_info; our $s_ref; $STMT3 = <<EOF; SELECT form_table.fname, form_table.title, form_table.desc, form_rec.form_url, form_rec.form_type FROM form_table, form_rec WHERE form_table.fname = form_rec.fname and form_table.fname LIKE '%$fname%' EOF if ($form_type ne "all") { my $ft_upper = uc($form_type); $STMT3a = <<EOF; and ((form_type = '$form_type') or (form_type = '$ft_upper')) EOF $STMT3 .= $STMT3a; } $sth3 = $db1->prepare($STMT3); if ( !defined($sth3) ) { warn join (" ",'ERROR', $db1->errstr, "$S +TMT3"); return 1; } $sth3->execute(); while($s_ref = $sth3->fetchrow_hashref) { %s_info = %$s_ref; if ($hdr == 0) { $htmln =<<EOF; <table width: 80%; border="1" cellpadding="2" cellspacing="1"> <tr> <td>File Name</td> <td>Title</td> <td>Description</td> <td>File Type</td> </tr> EOF $html .= $htmln; $hdr = 1 } #------------------------------------ Rows $htmln =<<EOF; <tr> <td><A HREF="$s_info{form_url}" TARGET="_blank" title="Go to $s_ +info{fname}">$s_info{fname}</A></td> <td>$s_info{title}</td> <td>$s_info{desc}</td> <td>$s_info{form_type}</td> </tr> EOF $html .= $htmln; #-------------------------------- end Rows } $htmln = <<EOF; </table> EOF $html .= $htmln; $htmln = <<EOF; <br> </body> </html> EOF $html .= $htmln; print $html; $db1->disconnect(); ------------------------------------------------------------
I get a error: The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.... ...HOWEVER, if I change the output for rows a follows:SELECT form_table.fname, form_table.title, form_table.desc, form_rec.f +orm_url, form_rec.form_type FROM form_table, form_rec WHERE form_tabl +e.fname = form_rec.fname and form_table.fname LIKE '%a%'
#------------------------------------ Rows $htmln =<<EOF; <tr> <td><A HREF="$s_info{form_url}" TARGET="_blank" title="Go to $s_ +info{fname}">$s_info{fname}</A></td> <td>$s_info{title}</td> <td> </td> #<---changed this line <td>$s_info{form_type}</td> </tr> EOF $html .= $htmln;
tofrom <td>$s_info{desc}</td>
<td> </td>
#------------------------------------ Rows $htmln =<<EOF; <tr> <td><A HREF="$s_info{form_url}" TARGET="_blank" title="Go to $s_ +info{fname}">$s_info{fname}</A></td> <td>$s_info{title}</td> <td>$s_info{title}</td> #<---repeated the prev <td> input <td>$s_info{form_type}</td> </tr> EOF $html .= $htmln;
Edited by planetscape - added readmore tags
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |