1
I’m getting this error message:
PHP Warning: Illegal offset type in E: home topdeia Web n-chipi atualizar-dados.php on line 9
The code I have is this:
session_start();
$acao = $_POST['acao'];
if ( isset($acao) && $acao == 'atualizar-quantidade' ){
$id = isset($_POST["id_qtd"]) ? $_POST["id_qtd"] : null;
$_SESSION["quantidade"][$id] = $_POST['quantidade'];
}
Following a tip, I did this, I added (string)
session_start();
$acao = $_POST['acao'];
if ( isset($acao) && $acao == 'atualizar-quantidade' ){
$id = isset($_POST["id_qtd"]) ? $_POST["id_qtd"] : null;
**$_SESSION["quantidade"][$id] = (string)$_POST['quantidade'];**
}
The message persists.
What is the line
9
in that stretch ? Look who you assign conditionallynull
to the variable$id
and then use it as an index.– Edilson
Hello @Edilson, line 9 is marked with asterisks in the second code snippet.
– adventistapr
The logic would not be, if there is no
id_qntd
not proceed with the change ?– Edilson