session_start(); global $scode; $linkID = mysql_connect("localhost", "root", "zangtang"); mysql_select_db("SciPark"); function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } //------------------------------------------------------------------------------------------------------------------------------------ // VERIFY FORM FUNCTION //--------------------------------------------------------------------------------------------------------------------------------------- function VerifyForm(&$values, &$errors) { if (htmlentities($values['BranchName']) == "Select") $errors['BranchName'] = "Branch Name Required"; if (htmlentities($values['SubCatName']) == "Select") $errors['SubCatName'] = "Theme/Topic Required"; if(htmlentities($values['SubCatName']) == "00") { if(strlen($values['SubCatOther'])== 0) $errors['SubCatOther'] = "Theme/Topic Required"; } if(htmlentities($values['ItemType']) == "Select") $errors['ItemType'] = "Type Required"; if(htmlentities($values['ItemType']) == "O") { if(strlen($values['ItemTypeOther'])== 0) $errors['ItemTypeOther'] = "Other's Name Required"; } if(htmlentities($values['SubCatName']) == "00") { $CatOther = htmlentities($values['SubCatOther']); $query1 = "SELECT * FROM `ExhbtCountMaster` where SubCatName='$CatOther'"; //echo $query1; $result1 = mysql_db_query("SciPark", $query1) or die ("could not query" . mysql_error()); $tung1=mysql_affected_rows(); if($tung1 != 0) $errors['SubCatOther'] = "The entered Sub-Category already listed in the drop down menu of Theme"; } if(strlen($values['ExhbtEName'])== 0) $errors['ExhbtEName'] = "Name Required"; // if(strlen($values['ExhbtMName'])== 0) $errors['ExhbtMName'] = "Name Required"; if(strlen($values['ExhbtEPrincipal'])== 0) $errors['ExhbtEPrincipal'] = "Principal Required"; // if(strlen($values['ExhbtMPrincipal'])== 0) $errors['ExhbtMPrincipal'] = "Principal Required"; // if(strlen($values['ExhbtScientist'])== 0) $errors['ExhbtScientist'] = "Inventor/Researcher's Name Required"; if(strlen($values['ExhbtEDescription'])== 0) $errors['ExhbtEDescription'] = "Description Required"; // if(strlen($values['ExhbtMDescription'])== 0) $errors['ExhbtMDescription'] = "Description Required"; if(strlen($values['ExhbtCount'])== 0 || !is_Numeric($values['ExhbtCount'])) $errors['ExhbtCount'] = "Numeric value in Count Required"; if(strlen($values['ExhbtWCount'])== 0 || !is_Numeric($values['ExhbtWCount'])) $errors['ExhbtWCount'] = "Numeric value in Working Count Required"; if (htmlentities($values['Vendor_Name']) == "Select") $errors['Vendor_Name'] = "Vendor Name Required"; if(htmlentities($values['Vendor_Name']) == "V001") { if(strlen($values['VendorArtist'])== 0) $errors['VendorArtist'] = "Artist Name Required"; } if(strlen($values['ExhbtPopularity'])== 0) $errors['ExhbtPopularity'] = "Popularity Required"; if(strlen($values['WebVisible'])== 0) $errors['WebVisible'] = "Web Visibility Yes/No Required"; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //print_r($errors); return (count($errors) == 0); } //--------------------------------------------------------------------------------------------------------------------------------------- // DISPLAY FORM FUNCTION //--------------------------------------------------------------------------------------------------------------------------------------- function outputOptionList($list, $selected) { foreach ($list as $item) echo "\n"; } function DisplayForm($values, $errors) { // $chars = "abcdefghijkmnopqrstuvwxyz023456789"; $i=0; $d=date(d); $m=date(F); $n=date(n); $y=date(Y); $optionListMonth = array( array('Value' =>'Select', 'Text' => '(select Month)'), array('Value' =>'01', 'Text' => 'January'), array('Value' =>'02', 'Text' => 'February'), array('Value' =>'03', 'Text' => 'March'), array('Value' =>'04', 'Text' => 'April'), array('Value' =>'05', 'Text' => 'May'), array('Value' =>'06', 'Text' => 'June'), array('Value' =>'07', 'Text' => 'July'), array('Value' =>'08', 'Text' => 'August'), array('Value' =>'09', 'Text' => 'September'), array('Value' =>'10', 'Text' => 'October'), array('Value' =>'11', 'Text' => 'November'), array('Value' =>'12', 'Text' => 'December'), ); $optionListYear = array( array('Value' => 'Select', 'Text' => "(select Year)"), array('Value' => '2018', 'Text' => "2018"), array('Value' => '2019', 'Text' => "2019"), array('Value' => '2020', 'Text' => "2020"), ); $OptionTypes = array( array('Value' => 'Select', 'Text' => "(select Type)"), array('Value' => 'E', 'Text' => "Exhibit"), array('Value' => 'T', 'Text' => "Teaching Aid"), array('Value' => 'K', 'Text' => "Kits"), array('Value' => 'D', 'Text' => "Demo Experiements"), array('Value' => 'O', 'Text' => "Other"), ); //print_r($optionListYear); $StdList = array( array('Value' =>'Select', 'Text' => 'Select'), array('Value' =>'1st Std.', 'Text' => '1st Std.'), array('Value' =>'2nd Std.', 'Text' => '2nd Std.'), array('Value' =>'3rd Std.', 'Text' => '3rd Std.'), array('Value' =>'4th Std.', 'Text' => '4th Std.'), array('Value' =>'5th Std.', 'Text' => '5th Std.'), array('Value' =>'6th Std.', 'Text' => '6th Std.'), array('Value' =>'7th Std.', 'Text' => '7th Std.'), array('Value' =>'8th Std.', 'Text' => '8th Std.'), array('Value' =>'9th Std.', 'Text' => '9th Std.'), array('Value' =>'10th Std.', 'Text' => '10th Std.'), array('Value' =>'11th Std.', 'Text' => '11th Std.'), array('Value' =>'12th Std.', 'Text' => '12th Std.'), ); ?>