<?php
include("connection.php");
include("frames_header.php");
?>

<?php


	

	if (isset($_GET["species"])) $species=$_GET["species"];

	if( (isset($_GET["species"])) and (strlen($species)>0) ){
		$query="SELECT \"NAME\", \"DEV_STAGE_ID\" FROM \"DEV_STAGE\" WHERE \"SPECIES\"='$species' ORDER BY \"DEV_PERCENT\"";
		$stmt = pg_query($c,$query) or die("<strong>Error</strong> ".pg_last_error($c));
	}



/*
	include("connection.php");
	
	if( (isset($_GET["species"])) and (strlen($species)>0) ){
		$requete = "SELECT DISTINCT NAME FROM CIONA_DESIGN.ANAT_ENTITY WHERE (SPECIES='$species') AND (TYPE!='cell') ORDER BY NAME";
		$resultset = OCIParse($connection, $requete);
		OCIExecute($resultset);
	}
*/
	
?>

<h2><strong><em>Anatomical dictionary modification.</em></strong> </h2>
<center>
<form name="formulaire" action="tree-editor2.php" method="get" target="_blank">
	<table width="99%" border="0" cellspacing="0" background="pictures/barre.jpg">
	  <tr bgcolor="#990000">
	  	<td></td><td></td><td></td><td align="right" background="pictures/barre-red.jpg"><em><strong>Anatomical dictionary</strong></em></td>
	  </tr><tr>
	  	<td align="right"><br><br><br><strong>Species</strong></td>
		<td align="left">
					<br><br><br>
                    <select name="species" size="1" onChange="self.location.href = 'tree-editor.php?species=' + this.options[ this.selectedIndex ].value">
                      <option ></option>
                      
                      <?php
                      
                      $requete="select \"NAME\" from \"SPECIES\" ";
                      $stmt0 = pg_query($c,$requete) or die("<strong>Error</strong> ".pg_last_error($c));
                      while($row0=pg_fetch_array($stmt0))
                      {
                        $species2=$row0["NAME"];
                        /*echo "<option value=\"$species2\" >$species2</option>";*/
				
                        if ($species==$species2)
						echo "<option value=\"$species\" selected>$species</option>";
					  else
						echo "<option value=\"$species2\">$species2</option>";
					  
			
                                    
                        }
				    ?>
                    </select>
		</td>
        <td align="right"><br><br><br><strong>Developmental stages:</strong></td>
		<td align="left">
			<br><br><br>
			            <select name="dev" size="10">
                        <option>_________________________</option>
                        <?php
						 $id="";
						 while($row=pg_fetch_array($stmt))
						 {
							print "<option value=\"".$row["DEV_STAGE_ID"]."\">";
							print $row["NAME"]."</option>\n";
							
							$id .= $row["DEV_STAGE_ID"].":";
						 }
					  	?>
                      </select>
		</td>
	  </tr>
	  
	  <tr>
	  	
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td align="right">
			<br><br>
			<input name="submit" type="image" src="pictures/button-submit.jpg" onClick="submit">&nbsp;&nbsp;&nbsp;
			<br>
		</td>
	  </tr>
	</table>

</form>
</center>

<?php
    include("frames_footer.php");
?> 