"; print_form(); } function process_form() { echo 'Hello ' . $_POST['first_name'] . '!'; } function isUKPostcode($postcode) { $postcode = strtoupper(str_replace(chr(32), '', $postcode)); $postcode_regex = "^(GIR0AA)|(TDCU1ZZ)|((([A-PR-UWYZ][0-9][0-9]?)|(([A-PR-UWYZ][A-HK-Y][0-9][0-9]?)|" ."(([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))))[0-9][ABD-HJLNP-UW-Z]{2})$"; return (ereg($postcode_regex, $postcode)) ? $postcode : false; } function fileUploadOK($field) { $valid_types = array("image/gif", "image/jpeg"); $max_size = 80 * 1024; if ((in_array($_FILES[$field]["type"], $valid_types)) && ($_FILES[$field]["size"] <= $max_size)) { return true; } return false; } function myEmpty($var) { return ((!isset($var)) || (strlen($var) <= 0)); } function validate_form() { $errors = array(); if (myEmpty($_POST['gender'])) { $errors['gender'] = "Please select your gender"; } if (myEmpty($_POST['full_name'])) { $errors['full_name'] = "Please enter your full name"; } else if (!ereg('^[a-zA-Z]\'-{2,75}$', $_POST['full_name'])) { $errors['full_name'] = 'Please enter your full name in the correct format'; } if (myEmpty($_POST['home_addres'])) { $errors['home_address'] = "Please enter your home address"; } else if (!ereg('^[0-9a-zA-Z]\'-{2,49}$', $_POST['home_address'])) { $errors['home_addres'] = "Please enter a valid home address"; } if (myEmpty($_POST['home_pcode'])) { $errors['home_pcode'] = "Please enter your home postcode"; } else if (!isUKPostcode($_POST['home_pcode'])) { $errors['home_pcode'] = "Please enter a valid home UK postcode"; } if (myEmpty($_POST['term_address'])) { $errors['term_address'] = "Please enter your term address"; } else if (!ereg('^[0-9a-zA-Z]\'-{2,49}$', $_POST['term_address'])) { $errors['term_address'] = "Please enter your a valid term address"; } if (myEmpty($_POST['term_pcode'])) { $errors['term_pcode'] = "Please enter your term postcode"; } else if (!isUKPostcode($_POST['term_pcode'])) { $errors['term_pcode'] = "Please enter a valid term-time UK postcode"; } if (myEmpty($_POST['home_phone'])) { $errors['home_phone'] = "Please enter a home telephone number"; } else if (!ereg('^(\+)[\s]*(.*)$', $_POST['home_phone'])) { $errors['home_phone'] = "Please enter a valid home telephone number"; } if (myEmpty($_POST['mob_phone'])) { $errors['mob_phone'] = "Please enter a mobile telephone number"; } else if (ereg('^\d{5} \d{6}$', $_POST['mob_phone'])) { $errors['mob_phone'] = "Please enter a valid mobile telephone number"; } if (myEmpty($_POST['email'])) { $errors['email'] = "Please enter a email address"; } else if (!ereg('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $_POST['email'])) { $errors['email'] = "Please enter a valid email address"; } if (myEmpty($_POST['country'])) { $errors['country'] = "Please select your nationality"; } if (myEmpty($_POST['dobDay'])) { $errors['dobDay'] = "Please select the day of your Date of Birth"; } if (myEmpty($_POST['dobMonth'])) { $errors['dobMonth'] = "Please select the month of your Date of Birth"; } if (myEmpty($_POST['dobYear']) || !ereg("[0-9]{4}", $_POST['dobYear'])) { $errors['dobYear'] = "Please enter the year of your Date of Birth"; } if (myEmpty($_POST['objective'])) { $errors['objective'] = "Please state your objective"; } else if (!ereg('^[a-zA-Z]$', $_POST['objective'])) { $errors['objective'] = "Your objective may only contain letters"; // ???? } if (myEmpty($_POST['preference'])) { $errors['preference'] = "Please state your preference"; } else if (!ereg('^[a-zA-Z]$', $_POST['preference'])) { $errors['preference'] = "Your preference may only contain letters"; // ???? } if (myEmpty($_POST['skills'])) { $errors['skills'] = "Please state your skills"; } else if (!ereg('^[a-zA-Z]$', $_POST['skills'])) { $errors['skills'] = "Your skills may only contain letters"; // ???? } if (!myEmpty($_POST['photograph']) && fileUploadOK("photograph", $_POST['photograph'])) { $errors ['photograph']= "

Please upload a valid photograph: " . $_FILES["file"]["error"] . "

"; } return $errors; } function print_form() { $days = ''; for ($x = 1; $x <= 31; $x++) { $days .= ""; } $months = ''; for ($x = 1; $x <= 12; $x++) { $months .= ""; } $current_year = date('Y'); $min_age = 5; $max_age = 99; $y = $current_year - $min_age; $years = ""; for ($x = $y; $x >= ($current_year - $max_age); $x--) { $years .= ""; } printf(' Erasmus CV Generator

Erasmus CV Generator


Gender:
Full Name:
Course:
Home Address:
 
 
 
Postcode:
Term Address:
 
 
 
Postcode:
Home Phone Number:
Mobile Phone Number:
Email:
Nationality:
Date of Birth:
Objective:
Placement Preference:
Transferable skills:

Please upload your photograph. The file must be gif/jpeg format and less than 80 KB in size.

Select Picture:
 
', $_SERVER["PHP_SELF"], $days, $months, $years); } ?>