I am getting a notice at Line A in the php code below. "Notice: Undefined index: check7456 at Line A
".
At Line B
, we are checking $list
is an array or not.
foreach ($_POST['rows'] as $AB_CD) {
$data = $dbo->execStmt("SELECT AB_NO, INFO, CAPACITY FROM TABLE_NAME1 WHERE AB_CD = {$AB_CD}");
$document = new Document($db, 'EDR', $data['AB_NO'][0], $data['INFO'][0], $data['CAPACITY'][0]);
$list = $_POST["check{$AB_CD}"]; // Line A
foreach ($values as $name) {
if (is_array($list) && in_array($name, $list)) { // Line B
$document->helloWorld('Good Day', $name);
} else {
$document->removeHelloWorld('Good Day', $name);
}
}
}
Problem Statement:
I am wondering what changes I need to do at Line A so that I can avoid this notice.
source https://stackoverflow.com/questions/75816162/notice-undefined-index-check7456-in-php
No comments:
Post a Comment