Presentation is loading. Please wait.

Presentation is loading. Please wait.

Students’ Registration for the MultiMedia Festival Students’ Registration for the MultiMedia Festival A Project on Perl Submitted by: Jayati Das Guided.

Similar presentations


Presentation on theme: "Students’ Registration for the MultiMedia Festival Students’ Registration for the MultiMedia Festival A Project on Perl Submitted by: Jayati Das Guided."— Presentation transcript:

1 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

2 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 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

4 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

5 The Solution Check for student’s existence using email id as key. Check for student’s existence using email id as key. Deny duplicate submission. Deny duplicate submission. my $statement = "SELECT email FROM jd_mm WHERE email = '$email'"; my $sth = $dbh- >prepare($statement); $sth->execute(); my @projects_values = $sth->fetchrow_array; $sth- >finish(); if($projects_values[0] ne "") { join('*', @projects_values), "\n "; print "Project record: $email $title2 already exists. "; exit; my $statement = "SELECT email FROM jd_mm WHERE email = '$email'"; my $sth = $dbh- >prepare($statement); $sth->execute(); my @projects_values = $sth->fetchrow_array; $sth- >finish(); if($projects_values[0] ne "") { join('*', @projects_values), "\n "; print "Project record: $email $title2 already exists. "; exit;

6 The Solution Contd… Input validation for email and phone number using regular expression. Input validation for email 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.555-555-5555. "; ( $phone !~ / \d{3} - \d{3} - \d{4} /x ){ print " Please enter your phone number in the correct format.eg.555-555-5555. "; ( $email !~ /^ [a-zA-Z] (?: \d | \w | \. | \-)* \@ \w+ \. (\w{3}) $/x ){ print " Please enter email address correctly. "; ( $email !~ /^ [a-zA-Z] (?: \d | \w | \. | \-)* \@ \w+ \. (\w{3}) $/x ){ print " Please enter email address correctly. "; elsif ($first eq "" or $last eq "" or $email 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 $email 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 ";

7 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, email, phone) VALUES ('$last', '$first', '$email', '$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, email, group_names, description) ". "VALUES ('$category', '$title2', '$software', '$semester', '$year', '$notes', '$accepted', ". "'$tech_merit', '$creative', '$groups', '$criteria', ". "'$class', '$email', '$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, email, phone) VALUES ('$last', '$first', '$email', '$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, email, group_names, description) ". "VALUES ('$category', '$title2', '$software', '$semester', '$year', '$notes', '$accepted', ". "'$tech_merit', '$creative', '$groups', '$criteria', ". "'$class', '$email', '$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", "Email", "Phone", "Class", "Semester", "Year", "software", "Notes", "Title", "Category", "Description", "Group", "Group Names" ] )), Tr( td( { -align => "center" }, [$first, $last, $email, $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", "Email", "Phone", "Class", "Semester", "Year", "software", "Notes", "Title", "Category", "Description", "Group", "Group Names" ] )), Tr( td( { -align => "center" }, [$first, $last, $email, $phone, $class, $semester, $year, $software, $notes, $title2, $category, $description, $groups, $group_names ] )))));

8 Demonstration

9 Demo contd…

10 Demo contd….

11 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 jayatid@gmail.com For any questions or comments, please contact jayatid@gmail.com


Download ppt "Students’ Registration for the MultiMedia Festival Students’ Registration for the MultiMedia Festival A Project on Perl Submitted by: Jayati Das Guided."

Similar presentations


Ads by Google