0

I have a JSON string in a session. If I pass the index 1000 in the array then I get a value, but when passing a dynamic value coming from the previous page then I get the error:

Undefined index: [6000 ] in D:\xampp\htdocs\vendor\ajaxItemSelect.php on line 23

My code:

<?php
    session_start();
    $jsonString = isset($_SESSION['jsonString']) ? $_SESSION['jsonString'] : '';
    if (isset($_REQUEST['selectedvalues'])){
        $selectedvalues = isset($_POST['selectedvalues']) ? $_POST['selectedvalues'] : '';
?>

<div class="form-group"><label class="control-label">

    <?php echo $jsonString['m_materialSupportedList'][1000]['itemName']['en'];

    echo $jsonString['m_materialSupportedList'][$selectedval]['itemFieldOneLabel']['en']; ?>
</label>
<?php } ?>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

0 Answers0