Update file editpage.php

This commit is contained in:
Jan BELLON 2024-03-11 09:31:31 +00:00
parent 48e252ba4f
commit dfca9e4c51

View File

@ -127,22 +127,27 @@ if(isset($fichier)) {
echo '<form action="?' . $filetypes[$filetype] . '=' . $filename . '" method="post">';
echo "<div><div class='button'><a href='editpage.php'>Retour</a></div>";
echo "<div><div class='button'><a href='news.php?article=" . $filename . "'>Voir l'article</a></div>";
echo '<div><select name="classification" required>';
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("SELECT classification FROM articles WHERE ID = :article");
$req->bindParam(":article", $_GET['article']);
$req->execute();
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
if(isset($_GET['article'])) {
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("SELECT classification, titre FROM articles WHERE ID = :article");
$req->bindParam(":article", $_GET['article']);
$req->execute();
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
foreach($classifications as $id => $nom) {
if((int)$resultat[0]['classification'] == $id) {
echo '<option value="' . $id .'" selected>' . $nom . '</option>';
} else {
echo '<option value="' . $id .'">' . $nom . '</option>';
if($resultat) {
echo '<div><select name="classification" required>';
foreach($classifications as $id => $nom) {
if((int)$resultat[0]['classification'] == $id) {
echo '<option value="' . $id .'" selected>' . $nom . '</option>';
} else {
echo '<option value="' . $id .'">' . $nom . '</option>';
}
}
echo "</select></div>";
$filename = $resultat[0]['titre'];
}
}
echo "</select></div>";
echo "<div><h1>" . $filename . "</h1></div>";
echo '<div><textarea name="page-content">' . $texte = str_replace("<br />", "", $contenu) . '</textarea></div>';
echo '<div><input type="submit" value="Publier"></div></form>';