Students’ Registration for the MultiMedia Festival Students’ Registration for the MultiMedia Festival A Project on Perl Submitted by: Jayati Das Guided by: Prof Jon Degallier
The Problem To populate and update an online student’s registration form To populate and update an online student’s registration form That will dynamically allow a student to register via the web That will dynamically allow a student to register via the web
3 The Approach Create manually the three tables in backend SQL database using SQL commands Create manually the three tables in backend SQL database using SQL commands The tables were: The tables were: Student Table Student Table Project Table Project Table Criteria table Criteria table
Approach contd…. Do input validation for the important fields Do input validation for the important fields Provide an error message citing the missing fields together with the form populated with the user's data. Provide an error message citing the missing fields together with the form populated with the user's data. Provide a 'Thank You' screen showing the data, which has been sent Provide a 'Thank You' screen showing the data, which has been sent
The Solution Check for student’s existence using id as key. Check for student’s existence using id as key. Deny duplicate submission. Deny duplicate submission. my $statement = "SELECT FROM jd_mm WHERE = '$ '"; my $sth = $dbh- >prepare($statement); $sth->execute(); = $sth->fetchrow_array; $sth- >finish(); if($projects_values[0] ne "") { "\n "; print "Project record: $ $title2 already exists. "; exit; my $statement = "SELECT FROM jd_mm WHERE = '$ '"; my $sth = $dbh- >prepare($statement); $sth->execute(); = $sth->fetchrow_array; $sth- >finish(); if($projects_values[0] ne "") { "\n "; print "Project record: $ $title2 already exists. "; exit;
The Solution Contd… Input validation for and phone number using regular expression. Input validation for and phone number using regular expression. Provide error message for missing fields. Provide error message for missing fields. ( $phone !~ / \d{3} - \d{3} - \d{4} /x ){ print " Please enter your phone number in the correct format.eg "; ( $phone !~ / \d{3} - \d{3} - \d{4} /x ){ print " Please enter your phone number in the correct format.eg "; ( $ !~ /^ [a-zA-Z] (?: \d | \w | \. | \-)* \w+ \. (\w{3}) $/x ){ print " Please enter address correctly. "; ( $ !~ /^ [a-zA-Z] (?: \d | \w | \. | \-)* \w+ \. (\w{3}) $/x ){ print " Please enter address correctly. "; elsif ($first eq "" or $last eq "" or $ eq "" or $phone eq "" or $title2 eq "" or $groups eq "" or $description eq ""){ print " Please fill in all the required fields marked with \* and then click submit "; elsif ($first eq "" or $last eq "" or $ eq "" or $phone eq "" or $title2 eq "" or $groups eq "" or $description eq ""){ print " Please fill in all the required fields marked with \* and then click submit ";
The Solution Contd… Inserting data into related tables. Inserting data into related tables. Thank you note. Thank you note. string = "INSERT INTO jd_mm (last, first, , phone) VALUES ('$last', '$first', '$ ', '$phone' );"; $dbh->do( $string ) or die("error in insert in table jd_mm"); my $string1 = "INSERT INTO jd_mm_projects (category, title, softwware, semester, year, notes, accepted, ". "tech_merit, creative, groups, criteria, class, , group_names, description) ". "VALUES ('$category', '$title2', '$software', '$semester', '$year', '$notes', '$accepted', ". "'$tech_merit', '$creative', '$groups', '$criteria', ". "'$class', '$ ', '$group_names', '$description');"; # print("degug mm_projects string: $string1"); $dbh->do( $string1 ) or die("error in insert in table jd_mm_projects"); string = "INSERT INTO jd_mm (last, first, , phone) VALUES ('$last', '$first', '$ ', '$phone' );"; $dbh->do( $string ) or die("error in insert in table jd_mm"); my $string1 = "INSERT INTO jd_mm_projects (category, title, softwware, semester, year, notes, accepted, ". "tech_merit, creative, groups, criteria, class, , group_names, description) ". "VALUES ('$category', '$title2', '$software', '$semester', '$year', '$notes', '$accepted', ". "'$tech_merit', '$creative', '$groups', '$criteria', ". "'$class', '$ ', '$group_names', '$description');"; # print("degug mm_projects string: $string1"); $dbh->do( $string1 ) or die("error in insert in table jd_mm_projects"); ( h4("Thank you for entering your data $first", br(), "The following data has been recorded:", br(), br(), table ( { -border => 3, -cellspacing =>3 }, Tr( th( [ "First Name", "Last Name", " ", "Phone", "Class", "Semester", "Year", "software", "Notes", "Title", "Category", "Description", "Group", "Group Names" ] )), Tr( td( { -align => "center" }, [$first, $last, $ , $phone, $class, $semester, $year, $software, $notes, $title2, $category, $description, $groups, $group_names ] ))))); ( h4("Thank you for entering your data $first", br(), "The following data has been recorded:", br(), br(), table ( { -border => 3, -cellspacing =>3 }, Tr( th( [ "First Name", "Last Name", " ", "Phone", "Class", "Semester", "Year", "software", "Notes", "Title", "Category", "Description", "Group", "Group Names" ] )), Tr( td( { -align => "center" }, [$first, $last, $ , $phone, $class, $semester, $year, $software, $notes, $title2, $category, $description, $groups, $group_names ] )))));
Demonstration
Demo contd…
Demo contd….
The End Result Henceforth, I hope this perl program will be useful for students to register online for the Multimedia Festival Henceforth, I hope this perl program will be useful for students to register online for the Multimedia Festival For any questions or comments, please contact For any questions or comments, please contact