<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>test</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> </head> <?php $lst = array(); if (!empty($_POST['mon_champ']['choice']) && is_array($_POST['mon_champ']['choice'])) { foreach ($_POST['mon_champ']['choice'] as $val) { $lst[] = $val; } } if (!empty($_POST['mon_champ']['txt'])) $lst[] = $_POST['mon_champ']['txt']; if (!empty($lst)) { echo 'Vous avez choisi : '; foreach ($lst as $val) { echo '<li>' . $val . '</li>'; } echo ''; } ?> <form method="post" action=""> <fieldset> <legend>Question 1</legend> <?php $val_lst = array(0, 10, 20, 30); foreach ($val_lst as $val) { $id = uniqid('q1_'); $chk = ''; if (!empty($_POST['mon_champ']['choice']) && in_array($val, $_POST['mon_champ']['choice'])) $chk = ' checked="checked"'; echo '<label for="', $id, '">', $val, '</label> '; } ?> " /> </fieldset> </form> </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question