Home PHP PHP - Creating a checkbox with limited choices

PHP - Creating a checkbox with limited choices

I am currently creating a PHP form in which there are check boxes.

I want to know how to limit the number of response options. For example, if the user checks more than one box, an error message is displayed.

Here's how it look:

Choice

1 2 3


Your choice : '; foreach ($_POST['reponse'] as $choix) { echo $choix.'
'; } } else { echo 'Please make a choice'; } } ?>

Solution

Choice

1 2 3
Your choice : '; foreach ($_POST['reponse'] as $choix) { echo $choix.'
'; } } else { echo 'Please make a choice'; } } ?>

Thanks to holow1 for this tip.

  • PHP

LEAVE A REPLY

Please enter your comment!
Please enter your name!