echo "checked "; } echo "/><br />\n"; } } // the list of values and labels for the checkboxes $personality_attributes = array('perky' => 'Perky', 'morose' => 'Morose', 'thinking' => 'Thinking', 'feeling' => 'Feeling', 'thrifty' => 'Spend-thrift', 'prodigal' => 'Shopper'); ?> <form action="<?php $_SERVER['PHP_SELF']; ?> " method="GET"> Select your personality attributes:<br /> <?php make_checkboxes('attributes', $attrs, $personality_attributes); ?> <br /> <input type="submit" name="s" value="Record my personality!" /> </form> <?php if (array_key_exists('s', $_GET)) { $description = join(" ", $_GET['attributes']); echo "You have a {$description} personality."; } ?> </body> </html>
color: #66f; } label { cursor: pointer; } </style> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <h1>Wat zijn je hobbies?</h1> <p><?php make_checkboxes('hobbies', $hobbies, $hobbies_selections); ?> </p> <h1>Welke huisdieren heb je?</h1> <?php make_checkboxes('huisdieren', $huisdieren, $huisdieren_selections, true); ?> <h1>Welke ziektes heb je (gehad)?</h1> <p><?php make_checkboxes('ziektes', $ziektes, $ziektes_selections); ?> </p> <p><input type="submit" value="verzenden"></p> </form> </body> </html>