0

I know that this may be duplicated but I can't really find any answer... Why is the $nInd variable undefined the lines after the start of the for loop?

  <?

                $nMaxDetailesArrSize=count($ArrDetailInfo);
                for($nInd=0;$nInd<$nMaxDetailesArrSize;$nInd++)

                  {

            ?>
                  <tr>
                    <td width="5%">
                         <input type="hidden" ID="hidPurDetID" name="hidPurDetID[]" value="<?=$ArrDetailInfo[$nInd]['PurInvDetID_Ind']?>">
                         <input type="hidden" ID="hidPrtID" name="hidPrtID[]" value="<?=$ArrDetailInfo[$nInd]['PrtID_FK']?>">
                         <input class="form-control input-xs" data-mand='y' id="txtPrtNum" name="txtPrtNum[]"   type="text" value="<?=$ArrDetailInfo[$nInd]['PrtNum']?>" <?=$strReadOnly?> />
                   </td>
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
  • PHP also allows for short open tag (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option). – JYoThI Jun 07 '17 at 12:15
  • What is the error message? I suspect it's not `$nInd` the undefined value but `$ArrDetailInfo[$nInd]`. This happens when the keys of the array are not numeric of they are not consecutive numeric values starting with `0`. – axiac Jun 07 '17 at 12:15
  • short_open_tag = Off you need to on this in php.ini file if you want use short open tag means – JYoThI Jun 07 '17 at 12:16

0 Answers0