Bonjour;
Je suis assez débutante en php , et j'ai un travail à remettre deadline demain matin, donc c'est assez urgent. aidez moi svp.
Alors je vous explique: je veux modifier les informations d'un utilisateur de la base de donnée. Donc ce que j'ai fais :
- dans mon fichier groupe j'ai juste un lien vers modif.php.
-dans modif.php j'affiche un formulaire avec les informations déjà saisi, ce formulaire m'envoit vers update.php apres le submit.
-dans update.php, je fais le traitement pour modifier les infos dans la BD
mon problème: aucun message d'erreur, mais j'ai une page blanche lors de l'execution
groupe_essai.php
modif.php
update.php
[code
<?php
if (isset($_GET["matricule"])){ $Matricule = $_GET["matricule"]; }
include("connexion.php");
include("classes.php");
$etudiant=new Etudiant();
$etudiant->setMatricule($_GET['matricule']);
echo getMatricule();
if (isset($_POST['Matricule']) && isset($_POST['nom']) && isset($_POST['prénom']) && isset($_POST['birthday'])
&& isset($_POST['Adresse']) && isset($_POST['année']) && isset($_POST['Filière'])&& isset($_POST['groupe']) )
{
$etudiant->setMatricule($_POST['Matricule']);
$etudiant->setNom($_POST['nom']);
$etudiant->setPrenom($_POST['prénom']);
$etudiant->setDate_Naiss($_POST['birthday']);
$etudiant->setAdresse($_POST['adresse']);
$etudiant->setFiliere($_POST['Filière']);
$annee = (int) $_POST['année'];
$etudiant->setannee($annee);
$groupe = (int) $_POST['groupe'];
$etudiant->setgroupe($groupe);
$req=$link1->prepare("SELECT Matricule FROM etudiant WHERE Matricule = :matricule ");
$req->execute(array(':matricule' => $_GET["matricule"]));
if( $req->rowCount()==1)
{
$update = $link1->prepare('UPDATE etudiant SET Matricule=: Matricule, Nom=:nom, Prénom=:prénom,
Birthday=:birthday, Adresse=:adresse, Code_Filière=:Filière, Code_Année=:annee,
Code_Groupe=:groupe WHERE Matricule=:matricule');
$update->execute(array(
':Matricule' => $etudiant->getMatricule(),
':nom' => $etudiant->getNom(),
':prénom' => $etudiant->getPrenom(),
':birthday' => $etudiant->getDate_Naiss(),
':adresse' => $etudiant->getAdresse(),
':Filière' => $etudiant->getFiliere(),
':annee' => $etudiant->getAnnee(),
':groupe' => $etudiant->getGroupe(),
));
header("location:modif.php?success=1");
}
else echo "Il y a un probleme";
}
?>
][/code]
Je suis assez débutante en php , et j'ai un travail à remettre deadline demain matin, donc c'est assez urgent. aidez moi svp.
Alors je vous explique: je veux modifier les informations d'un utilisateur de la base de donnée. Donc ce que j'ai fais :
- dans mon fichier groupe j'ai juste un lien vers modif.php.
-dans modif.php j'affiche un formulaire avec les informations déjà saisi, ce formulaire m'envoit vers update.php apres le submit.
-dans update.php, je fais le traitement pour modifier les infos dans la BD
mon problème: aucun message d'erreur, mais j'ai une page blanche lors de l'execution

groupe_essai.php
include("connexion.php");
if (isset($filiere) && isset($groupe)) {
$query = $link1->prepare("SELECT * FROM etudiant WHERE Code_Filière=:filiere AND Code_Groupe=:groupe");
$query->bindParam(':filiere',$filiere);
$query->bindParam(':groupe',$groupe);
} else if (isset($filiere) && !isset($groupe)) {
$query = $link1->prepare("SELECT * FROM etudiant WHERE Code_Filière=:filiere");
$query->bindParam(':filiere',$filiere);
} else $query = $link1->prepare("SELECT * FROM etudiant");
$query->execute();
while ($r = $query->fetch(PDO::FETCH_ASSOC)) {
?>
<tr onclick="SelectLigne(this)">
<td><b><?php echo "<a href=\"profil_essai.php?matricule=".$r['Matricule']."\"</a>"; echo $r['Matricule'];?></b><!-- Le lien vers le profil marche que pour cette utilisateur car on l'a fixé statiquement, par la suite on va envoyer le atricule en paramètre-->
<td><b><?php echo $r["Nom"]; ?></b></td>
<td><b><?php echo $r["Prénom"]; ?></b></td>
<td><?php echo $r["Code_Groupe"]; ?></td>
<td><?php echo "<a href='Absence_essai.php?matricule=",$r['Matricule'],"' id='abs' class='glyphicon glyphicon-user' ></a>";?></td> <!-- la variable ident selectionnera les info d'un étudiant préci -->
<td><?php echo "<a href='note_essai.php?matricule=",$r['Matricule'],"' id='note' class='glyphicon glyphicon-pencil'></a>"; ?></td>
<td><?php echo "<a href='modif.php?matricule=",$r['Matricule'],"' class='glyphicon glyphicon-wrench' ></a>";?></td> <!--modif=1, on affiche le formulaire d'insererion en gardant les infrmations déjà saisis. Pour cette etape le formulaire reste vide (sans php, js)-->
<td><?php echo "<a href='Suppression.php?matricule=",$r['Matricule'],"' id='del' onclick='DeleteEtud()' class='glyphicon glyphicon-remove-circle'></a>";?> </td>
</tr>
<?php
}
?>
modif.php
<?php
if (isset($_GET["success"])) {
?>
<script type='text/javascript'>
alert("Votre formulaire a bien été validé");
</script> <?
if (isset($_GET["matricule"])) $Matricule = $_GET["matricule"];
include("connexion.php");
//On se connecte d'abord sur la bdd pour récupérer les informations tout en créeant un nouvel objet
include("classes.php");
$etudiant=new Etudiant();
$etudiant->setMatricule($_GET['matricule']);
$query = $link1->prepare("SELECT Matricule, Nom, Prénom, Birthday, Adresse, Code_Filière, Code_Année, Code_Groupe FROM etudiant WHERE Matricule=:matricule");
$query->execute(array(':matricule' => $Matricule));
$r = $query->fetch(PDO::FETCH_ASSOC) ;
$etudiant->setMatricule($r['Matricule']);
$etudiant->setNom($r['Nom']);
$etudiant->setPrenom($r['Prénom']);
$etudiant->setDate_Naiss($r['Birthday']);
$etudiant->setAdresse($r['Adresse']);
$etudiant->setFiliere($r['Code_Filière']);
$etudiant->setAnnee($r['Code_Année']);
$etudiant->setGroupe($r['Code_Groupe']);
?>
<form method="POST" action="update.php?matricule=<?php echo $_GET["matricule"];?>" id="myForm">
<input type='hidden' name='submit' value='1' />
<fieldset>
<legend><b>Informations personnelles</b></legend>
<label class="form_col" for="nom">Nom :</label>
<input name="nom" id="nom" type="text" value="<?php echo $etudiant->getNom();?>"/>
<span class="tooltip">Un nom ne peut pas faire moins de 2 caractères</span>
<br/><br/>
<label class="form_col" for="prénom">Prénom :</label>
<input name="prénom" id="prénom" type="text" value="<?php echo $etudiant->getPrenom();?>"/>
<span class="tooltip">Un prénom ne peut pas faire moins de 2 caractères</span>
<br /><br />
<label class="form_col" for="Matricule">Matricule :</label>
<input name="Matricule" id="Matricule" type="text" value=" <?php echo $etudiant->getMatricule() ?>"onkeyup="verifMatricule(this.value);" />
<div id="BoxMat"></div>
<span class="tooltip">Le Matricule s'écrit sur 12 chiffres</span>
<br /><br />
<label class="form_col" for="birthday">Date de naissance : </label>
<input type="text" class="day" id="birthday" name="birthday" value="<?php echo $etudiant->getDate_Naiss();?>"placeholder="jj/mm/yyyy" />
<span class="tooltip">Vous devez remplir votre date de naissance, et celle-ci doit être valide.</span>
<br /><br />
<label class="form_col" for="Adresse">Adresse :</label>
<input name="adresse" id="Adresse" type="text" value="<?php echo $etudiant->getAdresse();?>" />
<span class="tooltip">L'Adresse ne peut pas faire moins de 4 caractères</span>
<br /><br />
<label class="form_col" for="Filière">Filière :</label>
<select name="Filière" id="Filière">
<option value="<?php echo $etudiant->getFiliere();?>">Sélectionnez votre Filière </option>
<option value="MIL">MIL</option>
<option value="SII">SII</option>
<option value="RSD">RSD</option>
</select>
<span class="tooltip">Vous devez sélectionner votre Filière </span>
<br /><br />
<label class="form_col" for="groupe">Groupe :</label>
<select name="groupe" id="groupe">
<option value="<?php echo $etudiant->getGroupe();?>">Sélectionnez votre Groupe</option>
<option value="1">Groupe1</option>
<option value="2">Groupe2</option>
<option value="3">Groupe3</option>
<option value="4">Groupe4</option>
</select>
<span class="tooltip">Vous devez sélectionner votre groupe</span>
<br /><br />
<label class="form_col" for="année">Année d'inscription :</label>
<select name="année" id="année">
<option value="<?php echo $etudiant->getAnnee();?>">Sélectionnez votre Année d'inscription</option>
<option value="1">1ère année Master</option>
<option value="2">2ème année Master</option>
</select>
<span class="tooltip">Vous devez sélectionner votre année d'inscription</span>
<br /><br />
<span class="form_col"></span>
<input type="submit" value="Ajouter" id="inserer" />
</fieldset>
update.php
[code
<?php
if (isset($_GET["matricule"])){ $Matricule = $_GET["matricule"]; }
include("connexion.php");
include("classes.php");
$etudiant=new Etudiant();
$etudiant->setMatricule($_GET['matricule']);
echo getMatricule();
if (isset($_POST['Matricule']) && isset($_POST['nom']) && isset($_POST['prénom']) && isset($_POST['birthday'])
&& isset($_POST['Adresse']) && isset($_POST['année']) && isset($_POST['Filière'])&& isset($_POST['groupe']) )
{
$etudiant->setMatricule($_POST['Matricule']);
$etudiant->setNom($_POST['nom']);
$etudiant->setPrenom($_POST['prénom']);
$etudiant->setDate_Naiss($_POST['birthday']);
$etudiant->setAdresse($_POST['adresse']);
$etudiant->setFiliere($_POST['Filière']);
$annee = (int) $_POST['année'];
$etudiant->setannee($annee);
$groupe = (int) $_POST['groupe'];
$etudiant->setgroupe($groupe);
$req=$link1->prepare("SELECT Matricule FROM etudiant WHERE Matricule = :matricule ");
$req->execute(array(':matricule' => $_GET["matricule"]));
if( $req->rowCount()==1)
{
$update = $link1->prepare('UPDATE etudiant SET Matricule=: Matricule, Nom=:nom, Prénom=:prénom,
Birthday=:birthday, Adresse=:adresse, Code_Filière=:Filière, Code_Année=:annee,
Code_Groupe=:groupe WHERE Matricule=:matricule');
$update->execute(array(
':Matricule' => $etudiant->getMatricule(),
':nom' => $etudiant->getNom(),
':prénom' => $etudiant->getPrenom(),
':birthday' => $etudiant->getDate_Naiss(),
':adresse' => $etudiant->getAdresse(),
':Filière' => $etudiant->getFiliere(),
':annee' => $etudiant->getAnnee(),
':groupe' => $etudiant->getGroupe(),
));
header("location:modif.php?success=1");
}
else echo "Il y a un probleme";
}
?>
][/code]