0

I have code, where i give date to my controller, and now i have big problem:

<td align="center">
    <input class="film_do_usuniecia" title="usuń" type="checkbox" name="film[usun][<?= $sVideo['2'] ?>][<?= $sVideo['3'] ?>]" />
</td>

I take my array with Post:

 $aKatalogi = $this->oRequest->getPostParam('film');


 if (is_array($aKatalogi['usun'])) {
     foreach ($aKatalogi['usun'] as $iKlucz => $sValue) {
         if (Tools::IsString($iKlucz, false) && $sValue == 'on') {
             $ftpconnection_video->f_delete_rs($iKlucz);
         }
      }
 }

And now is the problem:

How i can get this param: [<?= $sVideo['3']. In this param I have information about file: image or video.

I must checking it becouse if it image I delete it:

$ftpconnection_image->f_delete_rs($iKlucz);

If it is video:

$ftpconnection_video->f_delete_rs($iKlucz);

$iKlucz is a path do file. $sValue is a value of checkbox ON is pressed.

1 Answer 1

1

if i had really understood your question, is this the answer:

$sValue is an array, too. This array represent $sVideo['2']. That mean you must loop through this array to get the value of $sVideo['3']

i have tested with this little script:

//this is array is like your film request
$aKatalogi = array("usun" => array("sVideo2" => array("this is my value")));


if (is_array($aKatalogi['usun'])) {
     //loop throug the films
    foreach ($aKatalogi['usun'] as $iKlucz => $sVideo2Value) {

        if(is_array($sVideo2Value) ){
             //loop throug the sVideo2
            foreach ($sVideo2Value as $sVideo3Key => $sVideo3Value) {
                echo $sVideo3Value;
            }
        }

    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.