Pages vues depuis 25/05/2001 : 109 509 649
Index du forum »» Le coin des codeurs »» ça m'énerveuuuuuuhhh
Message édité par : reef-passion / 14-03-2008 15:59
.'<form method="post" action="modules.php" name="adminForm">'
.'<input type="hidden" name="ModPath" value="'.$ModPath.'">'
.'<input type="hidden" name="ModStart" value="'.$ModStart.'">'
.....
.'<input type="hidden" name="subop" value="supprimer">'
.'<input type="submit" class="bouton" value="'.trad('Valider').'">'
<form method="post" action="modules.php" name="tonform">'
<input type="hidden" name="ModPath" value="'.$ModPath.'">'
<input type="hidden" name="ModStart" value="'.$ModStart.'">'
.....
<?php
if($task == 1)
echo "<input type="hidden" name="task" value="2">";
else
echo "<input type="hidden" name="task" value="2">
<input type="submit" class="bouton" value="'.trad('Valider').'"> ";
echo $task;
switch ($task) {
case "1":
echo "test 1";
break;
case "2":
echo "test 2";
break;
default:
break;
}
?>
</form>
function ajouter($table, $uvnom, $uvdesc, $uvtype, $ajout){
//global $uvnom, $uvdesc, $uvtype;
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 \>");
echo("<table width=\"100%\" border=\"0\">\n
<form method=\"post\" name=\"ajoutuv\" action=\"modules.php?ModPath=$ModPath&ModStart=$ModStart&task=1\">\n
<tr>
<td width=\"30%\" align=\"left\" valign=\"middle\" ><strong>Nom de l'UV </strong></td>
<td width=\"70%\" align=\"left\" valign=\"middle\" ><input type=\"text\" name=\"uvnom\" size=\"11\" /></td>
</tr>
<tr>
<td width=\"30%\" align=\"left\" valign=\"middle\"><strong>Nom complet </strong></td>
<td width=\"70%\" align=\"left\" valign=\"middle\"><input type=\"text\" name=\"uvdesc\" size=\"50\" /></td>
</tr>
<tr>
<td width=\"30%\" align=\"left\" valign=\"middle\"><strong>Type de l'UV </strong></td>
<td width=\"70%\" align=\"left\" valign=\"middle\"><select name=\"uvtype\" size=\"1\">\n
<option>Tronc commun</option>
<option>spécialité</option>
<option>Formateur</option>
\n</select></td>
</tr>
<tr>
<td width=\"100%\" align=\"left\" valign=\"middle\"><input type=\"submit\" name=\"ajout\" value=\"Ajouter\"/></td>
</tr>
</form>\n
</table>\n ");
closetable(); }
function supprimer_uv($supprimer, $table, $uvnom, $uvselect,$ModPath, $ModStart){
//global ($task);
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");
//if($task == 1)
//echo ("<input type='hidden' name='task' value='2'>");
//else
//echo ("<input type='hidden' name='task' value='2'>");
echo("<table width=\"100%\" border=\"0\">\n
<form method=\"post\" name=\"supprimeuv\" action=\"modules.php?ModPath=$ModPath&ModStart=$ModStart&task=2>");
echo("<tr>
<td width=\"10%\" align=\"left\" valign=\"middle\"><strong>Nom de l'UV </strong>");
$query="SELECT * FROM $table order by uvnom";
$res=mysql_query($query);
echo("<select name=\"uvselect\">\n");
echo("<option value=-1> </option> ");
while($val=mysql_fetch_array($res))
{
$uvnom3=$val['uvnom'];
echo("<option value=$val>".$uvnom3."</option>");
}
echo(" \n</select> </td></tr>
<tr>
<td width=\"100%\" align=\"left\" valign=\"middle\">");
echo(" <input type=\"submit\" class=\"bouton\" name=\"supprimer\" value=\"Supprimer l'UV\"></td>
</tr>
</form></table>\n ");
closetable();
}
switch($task)
{
case 1: // ajouter une entrée dans la base Uv
ajouter ($table, $uvnom, $uvdesc, $uvtype, $ajout);
tableau_uv($table);
break;
Case 2: //Supprimer une donnée dans la base
supprimer_uv($supprimer, $table, $uvnom, $uvselect, $ModPath, $ModStart);
break;
};
};
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;
}