ynotlim
09-02-2006, 02:03 AM
I am creating a drop down selection box. Here is how it is coded right now
if ($major eq"") {print "<option value='' selected>Select";}
else {print "<option value=''>Select";}
if ($major eq"77279") {print "<option value='77279' selected>Aerospace Engineering";}
else {print "<option value=77279''>Aerospace Engineering";}
if ($major eq"60014") {print "<option value='60014' selected>African American Studies";}
else {print "<option value='60014'>African American Studies";}
if ($major eq"65063") {print "<option value='65063' selected>Anthropology";}
else {print "<option value='65063'>Anthropology";}
if ($major eq"97068") {print "<option value='97068' selected>Applied Ecology";}
else {print "<option value='97068'>Applied Ecology";}
if ($major eq"60093") {print "<option value'60093' selected>Art History";}
else {print "<option value='60093'>Art History";}
if ($major eq"5744D") {print "<option value'5744D' selected>Arts and Humanities";}
else {print "<option value='5744D'>Arts and Humanities";}
if ($major eq"57000") {print "<option value='57000' selected>Arts, Undeclared";}
else {print "<option value='57000'>Arts, Undeclared";}
if ($major eq"60100") {print "<option value='60100' selected>Asian American Studies";}
else {print "<option value='60100'>Asian American Studies";}
If a student already selected a Major, it pulls it from the database and previously selects it.
I have two database
1: for the Majors... table w/ Columns recno, major_code and major_name.
2: for the Students and one of the columns is student_major_code
here's what I think should be coded...
# for ($recno=1; $i<32; $i++) {
# $sel=' '; if ($major_code == $student_major_code) { $sel = 'SELECTED'; }
# print "<OPTION VALUE=\"$major_name{$major_code}\" $sel>$major_name\n";
# }
please help... give me the perl cgi script for connecting to both databases and all the other stuff
if ($major eq"") {print "<option value='' selected>Select";}
else {print "<option value=''>Select";}
if ($major eq"77279") {print "<option value='77279' selected>Aerospace Engineering";}
else {print "<option value=77279''>Aerospace Engineering";}
if ($major eq"60014") {print "<option value='60014' selected>African American Studies";}
else {print "<option value='60014'>African American Studies";}
if ($major eq"65063") {print "<option value='65063' selected>Anthropology";}
else {print "<option value='65063'>Anthropology";}
if ($major eq"97068") {print "<option value='97068' selected>Applied Ecology";}
else {print "<option value='97068'>Applied Ecology";}
if ($major eq"60093") {print "<option value'60093' selected>Art History";}
else {print "<option value='60093'>Art History";}
if ($major eq"5744D") {print "<option value'5744D' selected>Arts and Humanities";}
else {print "<option value='5744D'>Arts and Humanities";}
if ($major eq"57000") {print "<option value='57000' selected>Arts, Undeclared";}
else {print "<option value='57000'>Arts, Undeclared";}
if ($major eq"60100") {print "<option value='60100' selected>Asian American Studies";}
else {print "<option value='60100'>Asian American Studies";}
If a student already selected a Major, it pulls it from the database and previously selects it.
I have two database
1: for the Majors... table w/ Columns recno, major_code and major_name.
2: for the Students and one of the columns is student_major_code
here's what I think should be coded...
# for ($recno=1; $i<32; $i++) {
# $sel=' '; if ($major_code == $student_major_code) { $sel = 'SELECTED'; }
# print "<OPTION VALUE=\"$major_name{$major_code}\" $sel>$major_name\n";
# }
please help... give me the perl cgi script for connecting to both databases and all the other stuff