<div class="form-group has-error has-feedback">
<label class="control-label" for="inputError2">Input with error</label>
<input class="form-control" id="inputError2" aria-describedby="inputError2Status" type="text">
<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
<span id="inputError2Status" class="sr-only">(error)</span>
</div>
La démo est accessible ici en cas : http://getbootstrap.com/css/Je procède à une vérification si le champ à était saisie par l'utilisateur :
//Verification titre
if(empty($_POST['titre']))
{
$erreurs['titre'] = 'Renseigner un nom de sortie';
}
et mon input en lui même:
<label>titre :</label>
<input class="form-control" id="titre" type="text" name="titre" value="<?php if(isset($_POST['titre'])) echo $_POST['titre'];?>" />
<?php if(isset($erreurs['titre'])) echo '<div class="alert alert-danger" role="alert">' .$erreurs['titre'].'</div>';?>