- var_dump: documentation ( source)
<!DOCTYPE html>
<html>
<head>
<title>E-permanence</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control " content="no-cache">
<style>
label {
display:block;
margin: 20px 0 5px 0;
}
</style>
</head>
<body>
<h1>Inscription</h1>
<form name="form" method="post" action="$valeurs ternaires.php">
<label for="nom">Nom*</label>
<input name="nom" type="text" id="nom" maxlength="20">
<label for="prenom">Prenom*</label>
<input name="prenom" type="text" id="prenom" maxlength="20">
<label for="mail">Mail*</label>
<input name="mail" type="email" id="mail" maxlength="20">
<label for="sexe">Votre sexe</label>
<input name="sexe" type="text" id="sexe">
<label for="profession">Votre profession</label>
<input name="profession" type="text" id="profession">
<p><input type="submit" value="go"></p>
</form>
</body>
</html>
<?php
$nom = isset($_POST['nom']) ? $_POST['nom'] : "";
$prenom = isset($_POST['prenom']) ? $_POST['prenom'] : "";
$mail = isset($_POST['mail']) ? $_POST['mail'] : "";
$sexe = isset($_POST['sexe']) ? $_POST['sexe'] : "";
$profession = isset($_POST['profession']) ? $_POST['profession'] : "";
// <!-- Cas 1 -->
// if ($user == "" or $prenom == "" or $mail == "") {
if(empty($nom) || empty($prenom) || empty($mail)) { ?>
<html>
<head>
<title>Avertissement</title>
</head>
<body>
<?php // header("Location:e-perm_homepprofession.php?inscription=no&prob=1"); ?>
<h1>Erreur</h1>
<p style="font-weight:bold; color:#990000;">Veuillez remplir tous les champs requis</p>
<p><a href="e-perm_register.php">Retour</a></p>
</body>
</html>
<?php
} else {
// die(var_dump($sexe));
var_dump($nom);
var_dump($prenom);
var_dump($mail);
var_dump($sexe);
var_dump($profession);
}
?>