vendredi 6 mars 2020

How to Get Checkbox values in PHP using FOR loop only

Currently following code is working fine But I want an alternative code other than foreach loop,

 <form action="action_page.php" method="post">

        Select skills
        PHP
        <input type="checkbox" value="PHP" name="skills[]">
        JAVA
        <input type="checkbox" value="Java" name="skills[]">
        <input type="submit" value="submit">
    </form>

<?php

$skills=$_POST['skills'];
foreach($skills as $value){
    echo $value;
};
?>



Aucun commentaire:

Enregistrer un commentaire