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: Advanced:
Search CSV File Error.....please help

 



webhay
Novice

Oct 17, 2000, 5:31 AM

Post #1 of 1 (706 views)
Search CSV File Error.....please help Can't Post

I designed A form But And Builde DataBase With .CSV Ext But i Cant View or search in data Filed <TEXTAREA> becuse It Contant \n Spaces

THis My sample code Please correct it .....

#!/perl/perl

$filename="users.db";

$found=0;
###########################################################
print "Content-type: text/html\n\n";
print<<HTML;
<html>
<body>
HTML

print "<center><FONT SIZE=4 COLOR=\"#8080C0\" FACE=\"IMPACT\">Search Results</FONT></center>\n\n";


###########################################################

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs=split(/&/,$buffer);
foreach $pairs(@pairs){
($name,$value)=split(/=/,$pairs);
$value =~ tr/+/ /;
$value =~ tr/\0a//;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$FORM{$name} = $value;

}

################# Get data form file #########################
open (HANDEL,$filename);
@data=<HANDEL>;
close(HANDEL);

foreach $filed (@data)
{
chomp($filed);

($f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$f10,$f11,$f12,$f13,$f14,$f15,$f16,$f17,$f18,$f19,$f20,$f21,$f22,$f23,$f24,$f25,$f26,$f27,$f28,$f29,$f30,$f31,$f32,$f33,$f34,$f35,$f36,$f37,$f3 8,$f39,$f40,$f41,$f42,$f43,$f44,$f45,$f46,$f47)=split(/\;/,$filed);
$FORM{'$f15'} =~ s/\015?\012/<BR>/g;
$FORM{'$f22'} =~ s/\015?\012/<BR>/g;
$FORM{'$f29'} =~ s/\015?\012/<BR>/g;
$FORM{'$f46'} =~ s/\015?\012/<BR>/g;
$FORM{'$f47'} =~ s/\015?\012/<BR>/g;

if(($FORM{'search'}) =~ /$f1/)
{
print<<DATATABLE1;
<TR>
#<TD WIDTH=20% BGCOLOR='#C0C0C0'>$f1</TD>
#<TD WIDTH=20% BGCOLOR='#808080'>$f12</TD>
#<TD WIDTH=20% BGCOLOR='#C0C0C0'>$f19</TD>
#<TD WIDTH=20% BGCOLOR='#808080'>$f16</TD>
<TD WIDTH=20% BGCOLOR='#808080'>$f1<BR>$f2<BR>$f3<BR>$f4<BR>$f5<BR>$f6<BR>$f7<BR>$f8<BR>$f9<BR>$f10<BR>$f11<BR>$f12<BR> $f13<BR>$f14<BR>$f15<BR>$f16<BR>$f17<BR>$f18<BR>$f19<BR>$f20<BR>$f21<BR>$f22<BR>$f23<BR>$f24<BR>$f25<BR&g t;$f26<BR>$f27<BR>$f28<BR>$f29<BR>$f30<BR>$f31<BR>$f32<BR>$f33<BR>$f34<BR>$f35<BR>$f36<BR>$f37<BR>$f38<BR >$f39<BR>$f40<BR>$f41<BR>$f42<BR>$f43<BR>$f44<BR>$f45<BR>$f46<BR>$f47<BR></TD>
</TR>
\n\n
DATATABLE1
}
##########################################################################
} #END Foreach




------------------
Haytham Taher

 
 


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

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