<?php
session_start();
if ($_POST['section']!="") //je mets à jour ma variable section
{
$_SESSION['section']=$_POST['section'];
}
if (isset($_SESSION['login'])) { //je verifie le login
if ($_SESSION['login']!='cpe')
{ header("Location: ../index.php");}
; } else { header("Location: ../index.php");}?>
<?php require_once('../Connections/connect.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] && (isset($_POST['suivi'])) == "form1")) { //si validation je fais mon update
$updateSQL = sprintf("UPDATE choix_eleve SET suivi=%s WHERE id_nom_eleve=%s",
GetSQLValueString($_POST['suivi'], "text"),
GetSQLValueString($_POST['id_nom_eleve'], "int"));
mysql_select_db($database_connect, $connect);
$Result1 = mysql_query($updateSQL, $connect) or die(mysql_error());
$insertGoTo = "ajout_eleve_suivre.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
mysql_select_db($database_connect, $connect);
$query_section = sprintf("SELECT count(*),section_eleve FROM choix_eleve GROUP BY section_eleve HAVING count(*)>=1");
$result_section = mysql_query($query_section, $connect) or die(mysql_error());
$row_result_section = mysql_fetch_assoc($result_section);
$section=$_SESSION['section'];
$query_eleve = "SELECT * FROM choix_eleve WHERE section_eleve='$section' ORDER BY nom_eleve ASC";
$result_eleve = mysql_query($query_eleve, $connect) or die(mysql_error());
$row_result_eleve = mysql_fetch_assoc($result_eleve);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Gestion des sanction</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<LINK media=screen href="../style_menu.css" type=text/css rel=stylesheet>
<link href="../structure.css" rel="stylesheet" type="text/css">
</head>
<body>
<DIV id=page>
<DIV id=header>
<BR>
<H1>Gestion des élèves</H1>
<DIV class="description"> <p align="center">ADMINISTRATION<strong><br>
des sanctions</strong></p>
</DIV>
</DIV>
<HR>
<p align="center"> </p>
<script language="JavaScript" type="text/JavaScript">
function formfocus() {
document.form1.login.focus()
document.form1.login.select()
}
</script>
<form method="post" name="form1" action="ajout_eleve_suivre.php">
<table align="center">
<tr valign="baseline">
<td>
<table width="100%" border="0">
<tr>
<td align="right">choix de la section :</td>
<td align="center">
<select name="section" id="section2"> //le select concernat la classe
<?php
if ($section!=''){
?>
<option selected value="<?php echo $section?>"><?php echo $section ?></option>
<?php
}
else {
?>
<option selected value=""><?php echo 'selectionner une section'?></option>
<?php
}
do {
?>
<option value="<?php echo $row_result_section['section_eleve']?>"><?php echo $row_result_section['section_eleve']?>
</option>
<?php
} while ($row_result_section = mysql_fetch_assoc($result_section));
$rows = mysql_num_rows($result_section);
if($rows > 0) {
mysql_data_seek($result_section, 0);
$row_result_section = mysql_fetch_assoc($result_section);
}
?>
</select>
</td>
<td align="left"><input type="submit" value="valider"></td> //validation de la classe
</tr>
</table>
</form>
<br></td>
</tr>
<tr><td>Eleve de la classe</td></tr>
<TR> <td>
<form onLoad= "formfocus()" method="post" name="form1" action="ajout_eleve_suivre.php">
<table border="1" align="center"> //tableau concernant les élèves
<tr>
<td align="center">Nom</td>
<td colspan=>suivi</td> //colonne pour la modification du suivi
</tr>
<?php do { ?>
<tr>
<td class="Style6">
<input type="hidden" name="id_nom_eleve" value="<?php echo $row_result_eleve['id_nom_eleve']; ?>">
<?php echo $row_result_eleve['nom_eleve']; ?></td>
<td>
<select name="suivi" id="suivi2"> //select sur le suivi
<option selected value="<?php echo $row_result_eleve['suivi']?>"><?php echo $row_result_eleve['suivi']?></option> //premiere ligne du select, le champs de ma base
<option value="non">non</option>
<option value="suivi">suivi</option>
<option value="sous contrat">sous contrat</option>
</select>
</td>
</tr>
<?php } while ($row_result_eleve = mysql_fetch_assoc($result_eleve)); ?>
</table></td>
</tr>
<tr><td colspan=2><input type="submit" value="mettre à jour"></td></tr>
<tr valign="baseline">
<td align="center"><a href="index.php">Retour au Menu CPE </a></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<script> formfocus(); </script>
<p> </p>
<DIV id=footer></DIV>
</DIV>
</body>
</html>