mardi 21 mai 2019

Get input type="text" values by checked checkboxes

I'm doing a little project and want to get all input type="text" values if the checkbox is checked. How does it work?


<form name="test" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" target="_blank">
<?php
    foreach ($data['items'] as $key => $value) {
         echo "<label class="Items">
            <input type="checkbox" checked="checked" name="items[]" value="$value">
            <input type="text" value="$value">
        </label>";
    }
?>
</form>

Ive already tried this, but it only returned my checkbox values not my text values.

if(isset($_POST['items'])) {
     $items = $_POST['items'];
}




Aucun commentaire:

Enregistrer un commentaire