Below given is a simple piece of code and it works fine without any bugs in it.
Now the problem is I am getting this $phy_no from a select box of a form.
What if the user select multiple $phy_no in the select box (using control+) and sends multiple selects?
1- How to match multiple $phy_no with CC and get the corresponding results?
2- How the multiple selects are passed in the URL?
http://foo.com/*.cgi?name=John&multiple_selection=??????????????
Thanks for any input, I m totally confused here,
##########################################
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw/:standard/;
my $q = new CGI;
my $phy_no =$q->param('phy_no') || '00-0001';
print $q->header;
open (CC, "test.db") || die "cannot open the db file";
my @temp = <CC>;
foreach my $line(@temp) {
chomp $line;
if ($phy_no =~ /$ID/)
{
my ($name,$address,$ID) = split(/\|/, $line);
print "$address";
}
}
close (CC);
################ test.db ###################
Julie|Address Line 1 <br> Address Line 2|00-0003
Steven |Address Line 1 <br> Address Line 2|00-0001
Advani|Address Line 1 <br> Address Line 2|00-0002
########################################
Now the problem is I am getting this $phy_no from a select box of a form.
What if the user select multiple $phy_no in the select box (using control+) and sends multiple selects?
1- How to match multiple $phy_no with CC and get the corresponding results?
2- How the multiple selects are passed in the URL?
http://foo.com/*.cgi?name=John&multiple_selection=??????????????
Thanks for any input, I m totally confused here,
##########################################
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw/:standard/;
my $q = new CGI;
my $phy_no =$q->param('phy_no') || '00-0001';
print $q->header;
open (CC, "test.db") || die "cannot open the db file";
my @temp = <CC>;
foreach my $line(@temp) {
chomp $line;
if ($phy_no =~ /$ID/)
{
my ($name,$address,$ID) = split(/\|/, $line);
print "$address";
}
}
close (CC);
################ test.db ###################
Julie|Address Line 1 <br> Address Line 2|00-0003
Steven |Address Line 1 <br> Address Line 2|00-0001
Advani|Address Line 1 <br> Address Line 2|00-0002
########################################