Предполагая, что ваша начальная страница имеет это:
<form action="results.php" method="POST">
<input type="checkbox" name="checkbox1" value="1" />
<input type="checkbox" name="checkbox2" value="2" />
<input type="checkbox" name="checkbox3" value="3" />
<input type="submit" value="Submit" />
</form>
Ваш results.php
должен выглядеть примерно так:
<?php
echo isset($_POST['checkbox1']) ? "Box 1 is selected.<br />" : "Box 1 is not selected.<br />";
echo isset($_POST['checkbox2']) ? "Box 2 is selected.<br />" : "Box 2 is not selected.<br />";
echo isset($_POST['checkbox3']) ? "Box 3 is selected." : "Box 3 is not selected.";
?>
РЕДАКТИРОВАТЬ : Вы также можете прикрепить ихв переменные, как это:
$cb1 = isset($_POST['checkbox1']) ? true : false;
$cb2 = isset($_POST['checkbox2']) ? true : false;
$cb3 = isset($_POST['checkbox3']) ? true : false;
И сделать несколько if
утверждений:
if (!$cb1 && $cb2 && $cb3) {
echo "Option 1 is pretty much essential, or your gerbil
could escape within the first few hours of ownership.";
} else if ($cb1 && $cb2 && !$cb3) {
echo "If you don't get him a water bottle, he may turn vicious.";
} else if (!$cb1 && !$cb2 && !$cb3) {
echo "Right, that's it, we're calling the RSPCA!";
}
И так далее ...