I have a text file that I am trying to do a search on that will search for the input from the html page then if found return that line of information to a html page if not found will return a html page that says member not found
I have the code but when i run it retruns the following;
Search Results
END_HTML my = grep(/^jwset|/i, ); if () { foreach () { chomp; my = split /|/; print '', join(',', ), " "; } } else { print "
No results found.
";} print < Search Brought to you by Guild Masters
it is not doing the search for the name entered. can anyone help me with what I have wrong with the code.
here is the code;
#!/usr/bin/perl
use CGI qwstandard);
my $member_data = 'members.dat';
my $searchstr = param('username'); #name from html page
open(INF , "$member_data" ||die("Cannot Open Files"
print header;
print <<END_HTML;
<HTML>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800040" ALINK="#800040">
<TITLE>Search Results</TITLE>
<CENTER><BR><FONT SIZE="5" COLOR="#000000" FACE="ARIAL,TIMES NEW ROMAN">Search Results</FONT></CENTER><BR>
END_HTML
my @results = grep(/^$searchstr\|/i, <INF>);
if (@results)
{
foreach (@results)
{ chomp;
my @record = split /\|/;
print '<b>', join(',', @record), "</b>\n";
}
}
else { print "<p>No results found.</p>\n";}
print <<END_HTML;
<HR width="80%" noshade> <FONT SIZE="3" COLOR="#000000"
FACE="ARIAL,TIMES NEW ROMAN">Search Brought to you by Guild Masters</A></FONT></CENTER> </CENTER>
</A>
</BODY>
</HTML>
END_HTML
thank you for any help that I can get. been working on this for 2 weeks now to try and get it to work.
I have the code but when i run it retruns the following;
Search Results
END_HTML my = grep(/^jwset|/i, ); if () { foreach () { chomp; my = split /|/; print '', join(',', ), " "; } } else { print "
No results found.
";} print < Search Brought to you by Guild Masters
it is not doing the search for the name entered. can anyone help me with what I have wrong with the code.
here is the code;
#!/usr/bin/perl
use CGI qwstandard);
my $member_data = 'members.dat';
my $searchstr = param('username'); #name from html page
open(INF , "$member_data" ||die("Cannot Open Files"
print header;
print <<END_HTML;
<HTML>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800040" ALINK="#800040">
<TITLE>Search Results</TITLE>
<CENTER><BR><FONT SIZE="5" COLOR="#000000" FACE="ARIAL,TIMES NEW ROMAN">Search Results</FONT></CENTER><BR>
END_HTML
my @results = grep(/^$searchstr\|/i, <INF>);
if (@results)
{
foreach (@results)
{ chomp;
my @record = split /\|/;
print '<b>', join(',', @record), "</b>\n";
}
}
else { print "<p>No results found.</p>\n";}
print <<END_HTML;
<HR width="80%" noshade> <FONT SIZE="3" COLOR="#000000"
FACE="ARIAL,TIMES NEW ROMAN">Search Brought to you by Guild Masters</A></FONT></CENTER> </CENTER>
</A>
</BODY>
</HTML>
END_HTML
thank you for any help that I can get. been working on this for 2 weeks now to try and get it to work.