Vérifier le type d’une requête URL(POST ou GET)

Author:


Download

<?php
// Vérifier le type de requête
if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
 
?>
<html>
<head></head>
<body>
<form action="<?php echo $_SERVER['SCRIPT_NAME'] ?>" method="post">
<strong>Votre nom s'il vous plait?</strong>
<input type="text" name="nom" />
<input type="submit" value="Obtenir Cadeau" />
</form>
 
</body>
</html>
<?php } else {
    echo 'Bienvenu, ' . $_POST['nom'] . '!';
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *


× 4 = thirty six