Ok what i want to do(and i am having trouble with 1 little thing) is to create a page where u select from a list then click submit and it displays items from the list u selected.
Let says i wanted to select Doctor so i clicked on it from the dropdown menu list and then clicked submit. Then when the code was ran it would run a if statement finding out which one of the lists the user chose then displayed everything that was under that list. here is the code i have so far just having trouble with getting the if statment in there.
heres the html
ok
Dentist
Doctor
Health
Life
Car
heres the cgi
#!/usr/bin/perl
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
my $doctor = param('doctor');
my $dentist = param('dentist');
my $health = param('health');
my $life = param('life');
my $car = param('car');
print header;
if ($doctor);
open(OK, "./ok");
my $ok = ;
$ok =~ tr/ok/ok/;
print $ok;
close(OK);
Comments
ok
[b][/b]
Dentist
Doctor
Health
Life
Car
#!/usr/bin/perl
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
my $data_list_name = lc(param('list_to_display'));
my $data_file_name = "";
if($data_list_name eq "doctor")
{
$data_file_name = "doctor.dat";
#Any other doctor specific code goes here
}
elsif($data_list_name eq "dentist")
{
$data_file_name = "dentist.dat";
#Any other dentist specific code goes here
}
elsif($data_list_name eq "health")
{
$data_file_name = "health.dat";
#Any other heatlth specific code goes here
}
elsif($data_list_name eq "life")
{
$data_file_name = "life.dat";
#Any other life specific code goes here
}
elsif($data_list_name eq "car")
{
$data_file_name = "car.dat";
#Any other car specific code goes here
}
print header;
if($data_file_name ne "")
{
open(DATAFILE, "./$data_file_name");
my $data = ;
print $data;
close(DATAFILE);
}
Hi there,
Could you be kind enough to tell me the logical errors. i greatly like your post and answer it solved my problem accurately. If possible then kindly pinpoint some URLs.
Thanks and Take Care,
Hi there,
Could you be kind enough to tell me the logical errors. i greatly like your post and answer it solved my problem accurately. If possible then kindly pinpoint some URLs.
Thanks and Take Care,