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

<html>
<body bgcolor="#871F1F" text="#FFFFFF" link="#000000" vlink="#000000" alink="#000000">
<title>ANISEED</title>
<br>

<CENTER><H1>Add an anatomy part.</H1></CENTER><br>
<hr size="1">
<br>

<?php
$name=$_GET["name"];
$type=$_GET["type"];
$childof=$_GET["childof"];
$species=$_GET["species"];
$nomstade=$_GET["nomstade"];
$stadedev = $_GET["stadedev"];

if ($name =="")
{
	print '<center><H2>ERROR: please select a name for this anatomy part.</H2></center>';
	
	return;
}

if ($childof =="")
{
	print '<center><H2>ERROR: please select a "Child of id" for this anatomy part.</H2></center>';
	print "<br><br>";
	print '<center><input name="Exit" type="button" value="-= Close window =-" onClick="javascript:self.close();"></center>';
	return;
}

$requete="select * from \"ANAT_ENTITY\" where \"SPECIES\"='$species' and \"DEV_STAGE_ID\"='$stadedev' and \"ANAT_ID\"='$childof'";
$stmt = pg_query($c,$requete) or die("<strong>Error</strong> ".pg_last_error($c));
if($row=pg_fetch_array($stmt))
{
    print '<table>';
		print '<tr><td><font color="#CC0000"><H1><u>WARNING:</u></H1></font></td></tr>';
		print "<tr><td align=\"center\"><strong>Are you sure you want to <font size=\"+2\" color=\"#CC0000\">INSERT </font> a new anatomy part</strong></td></tr>";
		print '</table>';	
		
		echo "<hr size=\"1\">";
		echo "<CENTER><H2>Features :</H2>";
		
		echo "<table border=\"0\"  bgcolor=\"#999999\" background=\"pictures/barre.jpg\">";
		echo "<tr><td ALIGN=RIGHT>SPECIES :</td><td> $species</td></tr>";
		echo "<tr><td ALIGN=RIGHT>STAGE :</td><td> $nomstade</td></tr>";
		echo "<tr><td ALIGN=RIGHT>NAME :</td><td> $name</td></tr>";
		echo "<tr><td ALIGN=RIGHT>TYPE :</td><td> $type</td></tr>";
		echo "<tr><td ALIGN=RIGHT>CHILD OF :</td><td> $childof</td></tr>";
		echo "</TABLE><br><br>";
		
		//arguments
		print'<form action="addpartanat3.php" method="get" name="form1" target="_self">';
		print '<table>';
		print"<input name=\"name\" type=\"hidden\" value=\"$name\">";
		print "<input name=\"type\" type=\"hidden\" value=\"$type\">";
		print "<input name=\"childof\" type=\"hidden\" value=\"$childof\">";
		print"<input name=\"species\" type=\"hidden\" value=\"$species\">";
		print "<input name=\"nomstade\" type=\"hidden\" value=\"$nomstade\">";
		print "<input name=\"stadedev\" type=\"hidden\" value=\"$stadedev\">";
		
		print '<tr><td align="center"><center><img src="pictures/button-cur-delete.gif" title="Cancel"  onClick="javascript:self.close();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
		print '<input name="submit" type="image" src="pictures/button-cur-validate.gif" onClick="submit" title="Ok">';
		print '</table></center>';
		
		
		
		
		

	
}
else
{
	print "<CENTER><H2>ERROR : The \"CHILD OF id\" cannot be found in the ANISEED database.</H2></CENTER>";
	//print "<CENTER> Check if you are logged in or if the child of id is a good one.</center><br><br>";
	print '<br><center><input name="Exit" type="button" value="-= Close window =-" onClick="javascript:self.close();"></center>';
	return;

}

?>

</body>
</html>
 
