PHP: Gérer les caractères spéciaux envoyés par une requête

Author:


Download

<html>
<head></head>
<body>
    <?php
      if (isset($_POST['recherche'] ))
      {
        $recherche = $_POST['recherche'];
 
        $recherche = trim ($recherche);
 
        $recherche = strip_tags ($recherche);
 
        $recherche = htmlspecialchars ($recherche);
 
        $recherche = addslashes ($recherche);
 
        echo $recherche . "";
        ?><a href="index1.php">-essayer</a><?php
      }
      else{
        ?>
<form action="index.php" method="post">
 
Exemple:
 
          Recherche:
<input type="text" name="recherche" maxlength="150" />
<input type="submit" value="Envoyer" style="margin-top: 10px;" />
        </form>
 
        <?php
      }
    ?>
  </div>
 
</body>
</html>