for more details about $lang_arr, click here. */ $cls = $lang_arr[$_SESSION['ltag']]; //!Used for Database storage of some of the Bengali Baraha Codes. /*!
Description : In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author : Vijay Srinivas
Email : vijay.srini@frlht.org
*/ $SubstitutionArray['ben_']=array("[tr]"=>"Œ", "[tt]"=>"Š", "[~jj]"=>"…²", "[nD]"=>"—", "[pt]"=>"›", "[ddh]"=>"Ž", "[ndh]"=>"™", "[Thy]"=>"œ", "[~jc]"=>"ƒ"); //!Used for Database storage of some of the Marathi Baraha Codes. /*!
Description : In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author : Vijay Srinivas
Email : vijay.srini@frlht.org
*/ $SubstitutionArray['mar_']=array("[Dya]"=>"Ž"); //!Used for Database storage of some of the Hindi Baraha Codes. /*!
Description : In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author : Vijay Srinivas
Email : vijay.srini@frlht.org
*/ $SubstitutionArray['hin_']=array("[kk]"=>"‚ü", "[~gG]"=>"†¡û", "[~g~g]"=>"ˆû", "[cc]"=>"Š", "[~gm]"=>"‰", "[~gk]"=>"ƒ¡û", "[~gK]"=>"„¡û", "[~gg]"=>"…¡û", "[Ty]"=>"š", "[ThTh]"=>"›û", "[Thy]"=>"œ", "[DG]"=>"†û", "[Dk]"=>"ƒû", "[DK]"=>"„û", "[Dg]"=>"…û", "[DD]"=>"Œû", "[Dy]"=>"Ž", "[Dhy]"=>"ž"); //!Used for Database storage of some of the Tamil Baraha Codes. /*!
Description : In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author : Vijay Srinivas
Email : vijay.srini@frlht.org
*/ $SubstitutionArray['tam_']=array("[j]"=>"ˆ", "[ja]"=>"ƒ", "[~ju]"=>"š", "[~jU]"=>"œ", "[Sh]"=>"‰", "[Sha]"=>"„", "[S]"=>"Š", "[Sa]"=>"…", "[h]"=>"‹", "[ha]"=>"†", "[kSh]"=>"Œ", "[kSha]"=>"‡"); $SubstitutionArray['tel_']=array(); $SubstitutionArray['mal_']=array(); ?> "; //!The Current Record Date. $rec_date=date("Y-m-d H:i:s"); //!The Recipe Id field with a suffix of the language tag. /*!E.g kan_ for Kannada, hin_ for Hindi etc.*/ $nid = $_SESSION['ltag']."recipe_id"; //!The Tab Key field with a suffix of the language tag. /*!E.g kan_ for Kannada, hin_ for Hindi etc.*/ $tab = $_SESSION['ltag']."tab_key"; //!The Table Name with a suffix of the language tag. /*!E.g kan_ for Kannada, hin_ for Hindi etc.*/ $tabname=$_SESSION['ltag']."ailment"; //!The Ailment ID field with a suffix of the language tag. /*!E.g kan_ for Kannada, hin_ for Hindi etc.*/ $tabcol=$_SESSION['ltag']."ail_id"; if($_POST['submit']=='Add') { //refresh_ids($nid, $_SESSION['ltag'].'recipe'); $nid=generate_valid_id(get_next_id($nid, $_SESSION['ltag'].'recipe'),6); $insqry="INSERT INTO ".$_SESSION['ltag']."recipe (".$_SESSION['ltag']."recipe_id,recipe_name,recipe_detail,$tabcol) VALUES('$nid','".addslashes($_POST['recipe_name'])."','".addslashes($_POST['recipe_detail'])."','".$_POST[$tabcol]."')"; //$msg='Details Added successfully.'; //print $insqry."
"; $plant_cnt =count($_POST['plant_id']); $part_cnt = count($_POST['plant_part']); for ($i=0; $i<5;$i++) { if($_POST['plant_id'][$i]!="" && $_POST['plant_part'][$i]!="") { print "NOT NULL $i
"; //refresh_ids("tab_key", "rec_plant"); $tab=generate_valid_id(get_next_id("tab_key", "rec_plant"),6); //print "
INSERT INTO ".$_SESSION['ltag']."rec_plant (".$_SESSION['ltag']."tab_key, ".$_SESSION['ltag']."rec_id, plant_id,plant_part) VALUES ('$tab','$nid', ".$_POST['plant_id'][$i].", '".$_POST['plant_part'][$i]."')
"; mysql_query ("INSERT INTO ".$_SESSION['ltag']."rec_plant (".$_SESSION['ltag']."tab_key, ".$_SESSION['ltag']."rec_id, plant_id,plant_part) VALUES ('$tab','$nid', ".$_POST['plant_id'][$i].", '".$_POST['plant_part'][$i]."') ") or die(mysql_error()); } } //exit; } if($_POST['submit']=='Update') { //print_r ($_POST); if($_POST['newactn']=="addplants") { for ($i=0; $i<5;$i++) { print "Hello"; if($_POST['plant_id'][$i]!="" && $_POST['plant_part'][$i]!="") { //print "NOT NULL $i
"; //refresh_ids("tab_key", "rec_plant"); $tab=generate_valid_id(get_next_id("tab_key", "rec_plant"),6); //print "
INSERT INTO ".$_SESSION['ltag']."rec_plant (".$_SESSION['ltag']."tab_key, ".$_SESSION['ltag']."rec_id, plant_id,plant_part) VALUES ('$tab','".$_POST['id']."', ".$_POST['plant_id'][$i].", '".$_POST['plant_part'][$i]."')
"; if($_SESSION['ltag']) { } else mysql_query ("INSERT INTO ".""."rec_plant (".""."tab_key, ".""."rec_id, plant_id,plant_part) VALUES ('$tab','".$_POST['id']."', ".$_POST['plant_id'][$i].", '".$_POST['plant_part'][$i]."') ") or die(mysql_error()); } } // header('location:show_recipe.php'); } else if($_post['newactn']=="") { if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_') { $SubRecipeName=$_POST['recipe_name']; $SubRecipeDetail=$_POST['recipe_detail']; if($_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='mal_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $Skey=>$Sval) { $SubRecipeName=str_replace($Sval, $Skey, $SubRecipeName); $SubRecipeDetail=str_replace($Sval, $Skey, $SubRecipeDetail); } } $insqry="UPDATE ".$_SESSION['ltag']."recipe SET recipe_name='".utf8_decode(addslashes($SubRecipeName))."',recipe_detail='".utf8_decode(addslashes($SubRecipeDetail))."',".$_SESSION['ltag']."ail_id='".addslashes($_POST[$tabcol])."' WHERE ".$_SESSION['ltag']."recipe_id='".$_POST['id']."'"; // print $insqry; // exit(); } else { $RecipeName=addslashes($_POST['recipe_name']); $RecipeDetail=addslashes($_POST['recipe_detail']); $insqry="UPDATE ".$_SESSION['ltag']."recipe SET recipe_name='".$RecipeName."',recipe_detail='".$RecipeDetail."',".$_SESSION['ltag']."ail_id='".addslashes($_POST[$tabcol])."' WHERE ".$_SESSION['ltag']."recipe_id='".$_POST['id']."'"; } } } if($insqry!='') { $result=mysql_query($insqry) or die(mysql_error()); if($_GET['ToRef']) { $filenametolink='location:show_recipe.php#'.$_GET['ToRef']; } else { $filenametolink='location:show_recipe.php'; } header($filenametolink); } //!Initialization of Form Prototype. /*! for more details about Html_form method, click here. */ $curform=new Html_form('Addedit_'.'recipe'.'.php?ToRef='.$_GET['id'],'post','form1','','','chk_all',''); $curform->start(); if($_GET['id']!="") { $result=mysql_query("SELECT * FROM ".$_SESSION['ltag']."recipe WHERE ".$_SESSION['ltag']."recipe_id='".$_GET['id']."'"); $row=mysql_fetch_array($result); $curform->displayhidden("id",$_GET['id']); } print""; if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_'|| $_SESSION['ltag']=='mal_') { $RevSubRecipeName=utf8_encode($row['recipe_name']); $RevSubRecipeDetail=utf8_encode(stripslashes($row['recipe_detail'])); if($_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='mal_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $rskey=>$rsval) { $RevSubRecipeName=str_replace($rskey, $rsval, $RevSubRecipeName); $RevSubRecipeDetail=str_replace($rskey, $rsval, $RevSubRecipeDetail); } } $curform->displaytextrow('recipe_name','Recipe name',$RevSubRecipeName,36,'50',1,'','',$cls); $curform->displaytextarearow('recipe_detail','Recipe detail',$RevSubRecipeDetail,30,3,'255',1,$cls); } else { if(strpos($row['recipe_name'], "a:2:{i:0;s:")===false) { $RecipeName=$row['recipe_name']; } else { $ArrRecipeName=unserialize($row['recipe_name']); $RecipeName=$ArrRecipeName[1]; } if(strpos($row['recipe_detail'], "<=>")===false) { $RecipeDetail=$row['recipe_detail']; } else { $ArrRecipeDetail=explode("<=>", $row['recipe_detail']); $RecipeDetail=$ArrRecipeDetail[1]; } $curform->displaytextrow('recipe_name','Recipe name',$RecipeName,36,250,1,'','',$cls); $curform->displaytextarearow('recipe_detail','Recipe detail',stripslashes($RecipeDetail),30,3,'255',1,$cls); } //AILMENTS DROP DOWN $ail_list=get_list_data($tabname,$tabcol,array('ail_name'),'',"SELECT * FROM ".$_SESSION['ltag']."ailments ORDER BY ail_name"); if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_') { foreach($ail_list as $key=>$Val) { $RevSubVal=utf8_encode($Val); if($_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='mal_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $rskey=>$rsval) { $RevSubVal=str_replace($rskey, $rsval, $RevSubVal); } } $ail_list[$key]=$RevSubVal; } } foreach($ail_list as $key=>$Val) { if(strpos($Val, "a:2:{i:0;s:")===false) { $ail_list[$key]=$Val; } else { $ArrVal=unserialize($Val); $ail_list[$key]=stripslashes($ArrVal[1]); } } $curform->displayselectrow($tabcol,'Ailment',$ail_list,$row[$tabcol],'','','--- SELECT ---','','',$cls); if($_GET['id']=="") { print ""; print ""; print ""; //PLANTS DROP DOWN //$plants=get_list_data("'".$_SESSION['ltag']."ver_names'",'plant_id',array('NAME'),'',"SELECT * FROM ".$_SESSION['ltag']."ver_names WHERE lang_name='".$cls."' " ); $plants=get_list_data("'".$_SESSION['ltag']."botmast'",'plant_id',array('genus','species'),'',"SELECT * FROM ".$_SESSION['ltag']."botmast ORDER BY genus, species"); $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]t','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); } ELSE if($_GET['id'] !="") { $sql="SELECT * FROM ".""."rec_plant INNER JOIN ".$_SESSION['ltag']."recipe ON ".""."rec_plant.".""."rec_id = ".$_SESSION['ltag']."recipe.".$_SESSION['ltag']."recipe_id WHERE ".""."rec_plant.".""."rec_id=".$_GET['id']; //print $sql; $r = mysql_query($sql); $nm = mysql_num_rows($r); /* if($nm==0) { print ""; print ""; print ""; $plants=get_list_data("'".$_SESSION['ltag']."botmast'",'plant_id',array('genus','species'),'',"SELECT * FROM ".$_SESSION['ltag']."botmast ORDER BY genus, species"); $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part456',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]t','Plant Part',$row['plant_part'],35,100,1,'','',$cls); //PLANTS DROP DOWN $curform->displayselectrow('plant_id[]','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); $curform->displaytextrow('plant_part[]','Plant Part',$row['plant_part'],35,100,1,'','',$cls); $curform->displayHidden('newactn','addplants'); } */ } if($_GET['id']=="") { $curform->displayhidden("submit","Add"); $curform->displaysubmitrow("submit1","Add"); } else { $curform->displayhidden("submit","Update"); $curform->displaysubmitrow("submit1","Update"); } $curform->end(); print"
Add / Edit Recipe
 
Please enter plant and part used for the recipe
 
 
Please enter plant and part used for the recipe
 
"; } else { } ?>