mercredi 6 juin 2018

php if array has another array

Seems weird matter. Is there any way to detect array that contains sub-array in php, such parent-child concept in css, jquery. I want to insert data only if array has subarray

    <li>
        <input type="checkbox" name="menu[]" value="vehicle">
        <ul>
            <li><input type="checkbox" name="submenu[]" value="car"></li>
            <li><input type="checkbox" name="submenu[]" value="bike"></li>
         </ul>
    </li>
    <li><input type="checkbox" name="menu[]" value="sport"></li>

upload.php

$data = explode("," ,$_POST["menu"]); 
$subdata = explode("," ,$_POST["submenu"]);
foreach ($data AS $key => $menu){
    if(){         // This Menu has subarray

    }




Aucun commentaire:

Enregistrer un commentaire