Fix HTML balises order; add basic checks

This commit is contained in:
Némunaire 2012-05-18 22:50:06 +02:00
parent 3afabdf8ac
commit ef33e787a4
2 changed files with 36 additions and 30 deletions

View File

@ -4,30 +4,29 @@
<meta charset="utf8" /> <meta charset="utf8" />
<link rel="Stylesheet" href="style.css" /> <link rel="Stylesheet" href="style.css" />
<title>Every Questions</title> <title>Every Questions</title>
<body>
<header>
<div id="main_title">
<h1>Nemubot Questions</h1>
</div>
</header>
<form id="formulaire" method="post" action="questions.php">
<p>
<label for="question">Quelle est votre question ? </label>
<textarea id="question" name="question"
rows="10" cols="50"></textarea>
</p>
<p>
<label for="answer">Quelle est la réponse ? </label>
<input id="answer" name="answer" type="text" />
</p>
<p>
<input type="submit" name="send" value="Envoyer" />
</p>
</form>
</body>
</head> </head>
<body>
<header>
<div id="main_title">
<h1>Nemubot Questions</h1>
</div>
</header>
<form id="formulaire" method="post" action="questions.php">
<p>
<label for="question">Quelle est votre question ? </label>
<textarea id="question" name="question"
rows="10" cols="50"></textarea>
</p>
<p>
<label for="answer">Quelle est la réponse ? </label>
<input id="answer" name="answer" type="text" />
</p>
<p>
<input type="submit" name="send" value="Envoyer" />
</p>
</form>
</body>
</html>

View File

@ -2,11 +2,18 @@
if (isset ($_POST['send'])) if (isset ($_POST['send']))
{ {
$question=$_POST['question']; if (empty($_POST['question']) || empty($_POST['answer']))
$answer=$_POST['answer']; {
echo "Il manque la question ou la réponse !";
}
else
{
$question = $_POST['question'];
$answer = $_POST['answer'];
echo 'La question est : ' . $question . "<br/>"; echo 'La question est : ' . $question . "<br/>";
echo 'La réponse est : ' . $answer; echo 'La réponse est : ' . $answer;
}
} }
?> ?>