DEV Community

Soma Sundaram
Soma Sundaram

Posted on

PHP multiple checkbox click populate input field generate multiple times

PHP multiple checkbox click populate input field generate multiple times

if(isset($_POST['submit'])){
if(!empty($_POST['check_list'])) {    .
$checked_count = count($_POST['check_list']);
echo "You have selected following ".$checked_count." : <br/>";
foreach($_POST['check_list'] as $selected) {

Checked data is printed here twice

echo "<br><p>".'
<div class="col-sm-3"><input id="tooth1" name= "tooth[]" readonly value=" 
'.$selected.' " class="form-control" type="text"></div>
<div class="col-sm-3"><input

Top comments (0)