/*$tpid = $HTTP_GET_VARS[gesp];
$txt_btn = $HTTP_GET_VARS[txtbtname];*/
$tpid = $_GET['gesp'];
$txt_btn = $_GET['txtbtname'];
//print "POST "; print_r($_POST);
//PRINT "GET"; print_r($_GET);
if($_POST['go']=='go')
{
$g = explode(" ",$_POST['gesp']);
@mysql_select_db('frlhtenvis');
if($_POST['match'] == 'pattern') // PATTERN MATCH
{
// IF USER SPECIFIED BOTH GENUS AND SPECIES
if($g1[1] != "")
$q1 = "SELECT plant_id,genus,species,author FROM botmast WHERE genus like '%$g[0]%' || species like '%$g[0]%' || genus like '%$g[1]%' || species like '%$g[1]%' ORDER BY genus, species ";
// IF USER SPECIFIED ONLY GENUS OR SPECIES
else if($g1 == "")
$q1 = "SELECT plant_id,genus,species,author FROM botmast WHERE genus like '%$g[0]%' || species like '%$g[0]%' ORDER BY genus, species ";
$result2 = mysql_query ($q1,$link_id);
print "";
if(mysql_num_rows($result2) == 0)
print " Sorry, No Match Found ";
else
{ // DISPLAY A LIST OF PLANT NAMES
while ($o = mysql_fetch_object($result2))
{ print "";
print"".$o->genus." ".$o->species." | ";
}//while
}// mysql_num_rows!=0
print " ";
exit;
}//if pattern
else if($_POST['match'] == 'exact') //EXACT MATCH
{
$q1 = "SELECT plant_id,genus,species,author FROM botmast WHERE genus = '$g[0]' and species = '$g[1]' ORDER BY genus, species ";
$result2 = mysql_query ($q1,$link_id);
if(mysql_num_rows($result2) == 0)
print " Sorry, No Match Found.. If you are not sure with the plant name, please use pattern match ";
else
{
while ($o = mysql_fetch_object($result2))
{
//print " Found : ".$o->plant_id." ".$o->genus." ".$o->species." ";
printTable($o->plant_id);
exit;
}//while
}// mysql_num_rows!=0
}//else exact
}//if user clicked GO
else
{ //print_r($_GET);
// AFTER USER CLICKS ON PLANT-NAME FROM THE LIST OF PLANTS FETCHED USING PLANTS, disp_id IS PASSED.
if($_GET['disp_id']!="")
{ printTable($_GET['disp_id']);
exit;
}
}
// FORM
$curform=new Html_form('bot_search.php','post','btname','','','chk_all','');
$curform->start();
?>
@mysql_select_db('frlhtenvis');
//$q1 = "select plant_id, genus,species,author from botmast order by genus, species limit 0,300";
$q1 = "select plant_id, genus,species,author from botmast order by genus, species";
$result2 = mysql_query ($q1,$link_id);
// MAIN TABLE
print "";
print "";
//TABLE WITH INPUT BOX AND EXACT MATCH, PATTERN MATCH BUTTONS
echo "";
//DISPLAY ADV IMAGE
print " | ";
print " | ";
print " ";
print " ";
if($pid!=NULL)
{
print $pid;
echo "";
//DISPLAY PLANT DETAILS. $pid IS THE PLANT ID
printTable($pid);
}
// HTML BELOW IS THE FOOTER
?>
|
|