generer des champs inputs
- Accueil
- Forum
- Programmation
- PHP
- generer des champs inputs
Cafeine Le 16 mars 2017 à 16:00 (Édité le 25 janvier 2019 à 17:53)
TheOldNoob Le 16 mars 2017 à 20:45 (Édité le 16 mars 2017 à 20:46)
En gros, partout ou ton booleen est a 1, c'est qu'il est true.
Dans ton html, tu fait un if pour chaque matière. Si c'est true, c'est visible, c'est c'est false, ça sera invisible.
L'avantage avec se système, c'est qu'au moment ou tu inscrit l’élève dans ta bdd, tu peu faire des checkbox pour lui choisir ses matières.
Cafeine Le 16 mars 2017 à 21:32 (Édité le 1 janvier 1970 à 01:00)
TheOldNoob Le 16 mars 2017 à 23:42 (Édité le 16 mars 2017 à 23:44)
Le code que je te propose, me sere pour affiché ou non un commentaire dans un livre d'or
Le principe est le même. sauf que j'utilise pas un booleen, mais un champ enum avec 2 valeurs "show" et "hide"
<?php
$res = $pdo->prepare('SELECT * FROM gold_book WHERE accepted = :show ORDER BY date_add DESC');
$res->bindValue(':show', 'show');
$res->execute();
$notice = $res->fetchAll(PDO::FETCH_ASSOC);
foreach($notice as $not):
?>
<div class="col-xs-12 col-sm-12 col-md-6">
<blockquote><?php echo $not['desc_gold'] ?>" <cite><?php echo $not['name'].', le '. $not['date_add'] ?> </cite> </blockquote>
</div>
<?php endforeach; ?>
Cafeine Le 17 mars 2017 à 13:50 (Édité le 1 janvier 1970 à 01:00)
<?php
session_start();
include_once 'connect_bdd.php';
/*include 'verif_auth.php';
if (verif_auth::connecte()){
return true;
}else {
header("auth_prof.php");
}*/
if (isset($_SESSION['id_prof']) && !empty($_SESSION['id_prof'])){ ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="">
<meta property="og:site_name" content="">
<meta name="author" content="cafeine">
<title>Choix Classe</title>
<!-- CSS -->
<link rel="stylesheet" href="/peniel/Materialize/materialize-v0.97.6/materialize/css/materialize.min.css">
<!-- <link rel="stylesheet" href="/peniel/bootstrap-3.3.7-dist/bootstrap-3.3.7-dist/css/bootstrap.min.css"> -->
<link rel="stylesheet" href="/peniel/Semantic-UI-CSS-master/Semantic-UI-CSS-master/semantic.min.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="/peniel/style_peniel.css">
</head>
<body>
<nav>
<div class="nav-wrapper">
<a href="choix_classe.php?pseudo_prof =<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>" class="brand-logo"><i class="icon home" style="text-decoration: none;font-weight: bold;font-style: italic;font-size: 50px;margin-left: 150px;font-family: " Helvetica Neue", Helvetica, Arial, sans-serif">PCS</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="affiche_formul3.php?id_prof = <?= $_SESSION['id_prof']; ?>" style="font-size: large">Afficher Formulaire 3</a></li>
<li><a href="deconnexion.php" style="font-size: large">Se déconnecter</a></li>
</ul>
</div>
</nav>
<div id="container">
<!-- Page Content goes here -->
<div class="row" style="margin-top: 15%">
<div class="col s8" id="col">
<?php
$voir_elev = $bdd->query('SELECT * FROM eleve');
$voir_eleve = $voir_elev->fetch();
$voir_class = $bdd->query("SELECT * FROM classe");
while ($voirs_class = $voir_class->fetch()) { ?>
<?php
if($voirs_class['id_class']==1){?>
<a class="button button1" href="formulaire6.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> && nom_elev =<?= $voir_eleve['nom_elev'] ?>"><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==2){?>
<a class="button button2" href="formulaire5.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==3){?>
<a class="button button3" href="formulaire4.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==4){?>
<a class="button button4" href="formulaire3.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==5){?>
<a class="button button5" href="formulaireSA.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==8){ ?>
<a class="button button5" href="formulaireSC.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==9){ ?>
<a class="button button7" href="formulairePA.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==10){ ?>
<a class="button button7" href="formulairePD.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==11){ ?>
<a class="button button8" href="formulaireTA.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
if($voirs_class['id_class']==12){ ?>
<a class="button button8" href="formulaireTD.php?pseudo_prof=<?php if (isset($_SESSION['auth'])){echo $_SESSION['auth']['nom_prof'];} ?>
&& id_class = <?= $voirs_class['id_class'] ?> "><?= $voirs_class['lib_class'] ?>
</a>
<?php
}
?>
<?php } ?>
</div>
<div class="col s4"></div>
</div>
</div>
<!-- JS -->
<script type="text/javascript" src="/peniel/Jquery/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/peniel/bootstrap-3.3.7-dist/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!-- <script type="text/javascript" src="../peniel/Materialize/materialize-v0.97.6/materialize/js/materialize.min.js"></script> -->
</body>
</html>
<?php }else{
header("Location: auth_prof.php");
} ?>