<?php
include ("connection.php");
include ("frames_header.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));
	}
?>

<h2><strong><em>ADD not UNIGENE libraries. </em></strong> </h2>
<center>
	<form target="_blank" action="add-library-bis2.php" method="get" name="formulaire" >
		<table width="99%" border="0" cellspacing="0" background="pictures/barre.jpg">
			<tr bgcolor="#990000">
				<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td align="right" background="pictures/barre-red.jpg"><em><strong>Add Libraries</strong></em></td>
			</tr><tr>
				<td colspan="4"><br><input type="checkbox" name="test" value="y" checked>
					<strong>Perform read test without recording data.</strong></td>
			</TR><TR>
				<td>&nbsp;</td>	<td>&nbsp;</td>	<td>&nbsp;</td>	<td>&nbsp;</td>
			</TR><TR>
				<td colspan="4"><br><hr size="1" color="#990000"></td>	
			</TR><TR>
				<td colspan="4"><center><strong><H2>Enter library informations :</H2></strong></center><td>
			</TR><TR>
				<td>&nbsp;</td>	<td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td>
			</TR><TR>
				<td colspan="2" align="right"><strong>Species: </strong>&nbsp;</td>
				
        <td colspan="2" align="left">
            <select name="species" size="1">
		<!--  
		    <select name="species" size="1" onChange="self.location.href = 'add-library-bis1.php?species=' + this.options[ this.selectedIndex ].value">
		-->
		    <option selected></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\">$species</option>";
					  else
						echo "<option value=\"$species2\">$species2</option>";
					  }
				    ?>
          </select> </td>
			</TR><TR>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</TR><TR>	
				<td colspan="4" align="center"><strong>Library id :</strong>&nbsp;
				 <input name="lib_id" type="text" size="15" ></td>
			</TR><TR>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</TR><TR>
				<td colspan="2" align="center"><strong>Title :&nbsp;</strong>
				<input name="title" type="text" size="50" >
				<td colspan="2" align="center"><strong>Tissue :</strong>
				<input name="tissue" type="text" size="50" ></td>
			</TR><TR>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</TR><TR>
				<td colspan="2" align="center" ><br><strong>Developmental stage :</strong>
				    <input type="text" name="dev">

                      <?php
						/*
						print '<select name="dev" size="5" align="center"> <option>________________________</option>';
						 $id="";
						 while(OCIFetch($stmt))
						 {
							print "<option value=\"".OCIResult($stmt, "DEV_STAGE_ID")."\">";
							print OCIResult($stmt, "NAME")."</option>\n";
							
							$id .= OCIResult($stmt, "DEV_STAGE_ID").":";
						 }
						 print '</select>';
						 */
					  ?>
                      </td>
				<td colspan="2" align="center"><strong>Vector :</strong>
				<input name="vector" type="text" size="50" ></td>
			</TR><TR>
				<td colspan="4"><br><br><hr size="1" color="#990000"></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>

<br><br><br>

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