goldensunrise
Programmer
- Nov 22, 2000
- 18
Can anyone help me out?? I can't seem to get this to work right. It always goes back to the first item in the list. I would be greatful for any help.
to see it (not) working, go here:
***********
THE CODE
***********
print start_form({-enctype=>'multipart/form-data', -method=>'POST', -action=>'category.cgi'});
open ( CATEGORY, "category.txt" ) or die ( "Error opening category.txt" #Opens text file for read
open ( SUB, $catfile ) or die ( "Error opening $catfile" #Opens text file for read
#GENERATES CODE FOR MAIN CATEGORY DROP DOWN LIST BOX
print ('<SELECT name="mainCat">');
while ( <CATEGORY> ) {
$category = $_;
chomp $category;
print ('<CENTER><OPTION>', $category, '</OPTION></CENTER>', br);
}
print ('</SELECT>');
print (br, br);
#GENERATES CODE FOR SUB CATEGORY DROP DOWN LIST BOX
print ('<SELECT name="subCat">');
while ( <SUB> ) {
$sub = $_;
chomp $sub;
print ('<CENTER><OPTION>', $sub, '</OPTION></CENTER>', br);
}
print ('</SELECT>');
print (br, br);
close( SUB ) or die( "Cannot close $catfile" ); #Close text file
close( CATEGORY ) or die( "Cannot close category.txt" ); #Close text file
print (input({-type=>'submit'}), br);
print end_form;
to see it (not) working, go here:
***********
THE CODE
***********
print start_form({-enctype=>'multipart/form-data', -method=>'POST', -action=>'category.cgi'});
open ( CATEGORY, "category.txt" ) or die ( "Error opening category.txt" #Opens text file for read
open ( SUB, $catfile ) or die ( "Error opening $catfile" #Opens text file for read
#GENERATES CODE FOR MAIN CATEGORY DROP DOWN LIST BOX
print ('<SELECT name="mainCat">');
while ( <CATEGORY> ) {
$category = $_;
chomp $category;
print ('<CENTER><OPTION>', $category, '</OPTION></CENTER>', br);
}
print ('</SELECT>');
print (br, br);
#GENERATES CODE FOR SUB CATEGORY DROP DOWN LIST BOX
print ('<SELECT name="subCat">');
while ( <SUB> ) {
$sub = $_;
chomp $sub;
print ('<CENTER><OPTION>', $sub, '</OPTION></CENTER>', br);
}
print ('</SELECT>');
print (br, br);
close( SUB ) or die( "Cannot close $catfile" ); #Close text file
close( CATEGORY ) or die( "Cannot close category.txt" ); #Close text file
print (input({-type=>'submit'}), br);
print end_form;