<HTML>
<HEAD><link rel="stylesheet" type="text/css" href="page.css"></HEAD>
<BODY>
<div id="container">
<form enctype ="multipart/form-data" action ="menu.php" method="POST">
<?php 
$uploaddir='/wamp/www/tests/private/';
$uploadfile= $uploaddir. basename($_FILES['photo']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['photo']['tmp_name'],$uploadfile))
{
	echo"La fiche est valide et a été crée avec succés";
}
echo'</pre>';
$file = fopen($nom=$_POST['nom_medoc'].".html","w");
fwrite($file,"<HTML><br>");
fwrite($file,"\r\n");
fwrite($file,"<HEAD><link rel=stylesheet type=text/css href=page.css></HEAD><br>");
fwrite($file,"\r\n");
fwrite($file,"<BODY><br>");
fwrite($file,"\r\n");
fwrite($file,"<div id=container><br>");
fwrite($file,"\r\n");
fwrite($file,"<div id=header>");
fwrite($file,"\r\n");
fwrite($file,"<h1>Site internet du CHR de Lille</h1></div><br>");
fwrite($file,"\r\n");
fwrite($file,"<div id=menu><h2>Menu</h2><ul><li><a href=./menu.php>Retour au menu</a></li></ul></div>");
fwrite($file,"<div id=contents>");
fwrite($file,"<a name=content></a><h2>$_POST[nom_medoc]($_POST[molecule])</h2>");
fwrite($file,"\r\n");
fwrite($file,"<p><img class=imagefloat src=./$_POST[nom_medoc].jpg alt=$_POST[nom_medoc] width=150 height=150 /></p>");
fwrite($file,"<br/>");
fwrite($file,"<a name=content></a><h2>Posologie</h2>");
fwrite($file,"$_POST[posologie]");
fwrite($file,"<a name=content></a><h2>Indications</h2>");
fwrite($file,"$_POST[indic]</form>		  
</BODY>
</HTML>");
fwrite($file,"</div></div></BODY>");
fwrite ($file,"</HTML>");
fclose($file);
?>
<input type="submit" value="retour au menu" name="retour"/>

<?php
if(isset($_POST['retour']))
header('location:./liste_fiche.php');
?>
</BODY>
</HTML>