oim 1453
| Posté : 17-03-2008 12:44
function ajouter($table, $uvnom, $uvdesc, $uvtype, $ajout)
{
global $ModPath, $ModStart;
if ($ajout)
{
$query="INSERT INTO $table VALUES('','$uvnom','$uvdesc','$uvtype')";
$res=mysql_query( $query);
if ($res)
{
echo" <center><h4>Entrée ajoutée</h4></center>";
}
}
opentable();
echo "<br \><img src=\"themes/Permanent-Double-Side/images/ajoutuv.gif\"><br \>
<table>\n
<form method=\"post\" action=\"modules.php\" name=\"adminForm\">
<input type=\"hidden\" name=\"ModPath\" value=\"$ModPath\" />
<input type=\"hidden\" name=\"ModStart\" value=\"$ModStart\" />
<tr>
<td>Nom de l'UV</td>
<td><input type=\"text\" name=\"uvnom\" size=\"11\" /></td>
</tr>
<tr>
<td >Nom complet</td>
<td><input type=\"text\" name=\"uvdesc\" size=\"50\" /></td>
</tr>
<tr>
<td>Type de l'UV</td>
<td>
<select name=\"uvtype\" size=\"1\">
<option>Tronc commun</option>
<option>spécialité</option>
<option>Formateur</option>
</select>
</td>
</tr>
<tr>
<input type=\"hidden\" name=\"task\" value=\"ajoutuv\" />
<td><input type=\"submit\" value=\"Ajouter\"/></td>
</tr>
</form>
</table>\n";
closetable();
}
function supprimer_uv($supprimer, $table, $uvnom, $uvselect)
{
global $ModPath, $ModStart;
if ($supprimer)
{
$query="DELETE * FROM $table WHERE uvnom = ".$uvselect."";
$res=mysql_query( $query);
if ($res)
{
echo" <center><h4>Entrée supprimée</h4></center>";
}
}
opentable();
echo "<br \><img src=\"themes/Permanent-Double-Side/images/supuv.gif\"><br \>";
$task=("2");
echo "<table>
<form method=\"post\" action=\"modules.php\" name=\"adminForm\">
<input type=\"hidden\" name=\"ModPath\" value=\"$ModPath\" />
<input type=\"hidden\" name=\"ModStart\" value=\"$ModStart\" />
<tr>
<td>Nom de l'UV";
$query="SELECT * FROM $table order by uvnom";
$res=mysql_ query($query);
echo "<select name=\"uvselect\">
<option value=-1> </option>";
while($val=mysql_fetch_array($res))
{
$uvnom3=$val['uvnom'];
echo "<option value=$val>".$uvnom3."</option>";
}
echo "</select>
</td>
</tr>
<tr>
<input type=\"hidden\" name=\"task\" value=\"supprimeuv\" />
<td><input type=\"submit\" value=\"Supprimer l'UV\"/></td>
</tr>
</form>
</table>";
closetable();
}
switch($task)
{
case 'ajouter':
ajoutuv ($table, $uvnom, $uvdesc, $uvtype, $ajout);
tableau_uv($table);
break;
case 'supprimer_uv':
supprimer_uv($supprimer, $table, $uvnom, $uvselect);
break;
}
|