0
Good afternoon friends, I’m not able to save the second INSERT in the bank, because when I save, it goes as array, how can I solve this problem?
Image of the View:
Picture of the Bank
Code
$nome_plano = trim($_POST["nome_plano"]);
    $quemcadastrou = $userRow['nome_funcionario'];
    
try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $conn->beginTransaction();
      $conn->exec("INSERT INTO plano (nome_plano, quemcadastrou, data_hora_cadastro) VALUES ('$nome_plano', '$quemcadastrou', NOW())");
        $lastid = $conn->lastInsertId();
    
        foreach($_POST['informacao'] as $informacao){    
                $parcelaplano[''] = trim($_POST['parcelaplano']);
                $porcentagem[] = trim($_POST['porcentagem']);
                $conn->exec("INSERT INTO inform_plano (id_plano, parcelaplano, porcentagem) VALUES ('$lastid', '$parcelaplano', '$porcentagem')");
                print_r($informacao);
    }
    // commit the transaction
    $conn->commit();
     echo "<h1>CADASTRADO COM SUCESSO</h1>";
    }
catch(PDOException $e)
    {
    // roll back the transaction if something failed
    $conn->rollback();
    echo "Error: " . $e->getMessage();
    }
$conn = null;
						

It worked out, thank you buddy...
– Mauro Santos