modification et amelioration du formulaire d'ajout de jeu (ajout d'un bouton pour retourner à l'accueil et css)
This commit is contained in:
@@ -1,37 +1,68 @@
|
|||||||
<h2><?php echo isset($jeu) ? "Modifier le jeu" : "Ajouter un nouveau jeu"; ?></h2>
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Ajouter un nouveau jeu</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f7f6; color: #333; margin: 0; padding: 20px; }
|
||||||
|
.container { max-width: 650px; margin: 40px auto; background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
|
||||||
|
|
||||||
<?php
|
/* Style du bouton retour */
|
||||||
if (isset($jeu)) {
|
.back-link { display: inline-block; background: #ecf0f1; padding: 8px 15px; border-radius: 5px; color: #2c3e50; text-decoration: none; margin-bottom: 25px; font-weight: bold; transition: background 0.3s; }
|
||||||
// Si modification, on envoie vers la fonction de mise à jour avec l'ID
|
.back-link:hover { background: #bdc3c7; }
|
||||||
echo form_open('jeux/mettre_a_jour/' . $jeu['id']);
|
|
||||||
} else {
|
|
||||||
// Si ajout, on garde l'ancienne action
|
|
||||||
echo form_open('jeux/sauvegarder');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<p>
|
h2 { color: #2c3e50; border-bottom: 2px solid #ecf0f1; padding-bottom: 10px; margin-bottom: 30px; margin-top: 0; }
|
||||||
<label for="titre">Titre du jeu :</label>
|
|
||||||
<input type="text" name="titre" id="titre" value="<?php echo isset($jeu) ? html_escape($jeu['name']) : ''; ?>" required>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
/* Style du formulaire */
|
||||||
<label for="annee">Année de sortie :</label>
|
.form-group { margin-bottom: 20px; }
|
||||||
<input type="number" name="annee" id="annee" value="<?php echo isset($jeu) ? html_escape($jeu['releaseYear']) : ''; ?>" required>
|
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #34495e; }
|
||||||
</p>
|
.form-group input[type="text"],
|
||||||
|
.form-group input[type="number"],
|
||||||
|
.form-group textarea { width: 100%; padding: 11px; border: 1px solid #bdc3c7; border-radius: 4px; font-size: 16px; box-sizing: border-box; outline: none; font-family: inherit; }
|
||||||
|
.form-group input:focus, .form-group textarea:focus { border-color: #3498db; box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); }
|
||||||
|
|
||||||
<p>
|
.btn-submit { display: inline-block; background-color: #2ecc71; color: white; padding: 12px 25px; border: none; border-radius: 5px; font-size: 16px; font-weight: bold; cursor: pointer; transition: background 0.3s; width: 100%; margin-top: 10px; }
|
||||||
<label for="description">Description courte :</label><br>
|
.btn-submit:hover { background-color: #27ae60; }
|
||||||
<textarea name="description" id="description" rows="4" cols="50" required><?php echo isset($jeu) ? html_escape($jeu['shortDescription']) : ''; ?></textarea>
|
</style>
|
||||||
</p>
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
<p>
|
<div class="container">
|
||||||
<label for="prix">Prix (en centimes) :</label>
|
<a href="<?= site_url('home') ?>" class="back-link">⬅ Retour à l'accueil</a>
|
||||||
<input type="number" name="prix" id="prix" value="<?php echo isset($jeu) ? html_escape($jeu['price']) : ''; ?>">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<h2>Ajouter un nouveau jeu vidéo</h2>
|
||||||
<button type="submit"><?php echo isset($jeu) ? "Mettre à jour" : "Enregistrer"; ?></button>
|
|
||||||
</p>
|
<form action="<?= site_url('jeux/ajouter') ?>" method="POST" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name">Nom du jeu :</label>
|
||||||
|
<input type="text" id="name" name="name" required placeholder="Ex: Zelda: Breath of the Wild">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="releaseYear">Année de sortie :</label>
|
||||||
|
<input type="number" id="releaseYear" name="releaseYear" required placeholder="Ex: 2017">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="developer_name">Développeur :</label>
|
||||||
|
<input type="text" id="developer_name" name="developer_name" placeholder="Ex: Nintendo">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="price">Prix (en centimes, ex: 4999 pour 49,99 €) :</label>
|
||||||
|
<input type="number" id="price" name="price" placeholder="Ex: 4999">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="shortDescription">Description courte :</label>
|
||||||
|
<textarea id="shortDescription" name="shortDescription" rows="5" placeholder="Écrivez le résumé du jeu ici..."></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn-submit">➕ Valider et ajouter le jeu</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user