0
My "echo" below this bringing from the database the special characters all broken as it fixes that situation ????
<html>
<head>
<title>Resultados da busca</title>
<!-- Ligação com o css -->
</head>
<body>
<br /><br />
<!-- Ligação com o banco -->
<?php include 'css/config.php'; ?>
<?php
//Variáveis que recebem os dados preenchidos no formulário (cadastroProfTela1.html)
session_start();
$uni= utf8_decode( $_POST[uni] );
$mod= utf8_decode( $_POST[mod] );
$ano= utf8_decode( $_POST[ano] );
$turma=$_POST['turma'];
$turno= utf8_decode( $_POST[turno] );
//Variáveis globais (podem ser utilizadas em todas as outras páginas do sistema)
$_SESSION['uni'] = $uni;
$_SESSION['mod'] = $mod;
$_SESSION['ano'] = $ano;
$_SESSION['turma'] = $turma;
$_SESSION['turno'] = $turno;
//Select no banco para selecionar todos os dados solicitados no formulário (cadastroProfTela1.html)
$sql = mysqli_query($conexao,"SELECT * FROM cadastros WHERE unidade LIKE '%".$uni."%' AND modalidade LIKE '%".$mod."%' AND ano LIKE '%".$ano."%'
AND turma LIKE '%".$turma."%' AND turno LIKE '%".$turno."%'");
//Testa se os dados existem no banco, caso exista ele exibe na tela
$row = mysqli_num_rows($sql);
if ($row > 0) {
while ($linha = mysqli_fetch_array($sql)) {
$id=$linha['id'];
$reg=$linha['regional'];
$rpa=$linha['rpa'];
$tpu1=$linha['tipoUnidade'];
$uni=$linha['unidade'];
$mod=$linha['modalidade'];
$ano=$linha['ano'];
$turma= utf8_decode( $linha[turma] );
$turno=$linha['turno'];
$situacaoTurma=$linha['situacaoTurma'];
$matricula=$linha['matricula'];
$cpf=$linha['cpf'];
$nomeProfEfetivo=$linha['nomeProfEfetivo'];
$cargo=$linha['cargo'];
}
if ($matricula != "") {
echo "<strong>ID: </strong>".@$id;
echo "<br /><br />";
echo "<strong>Regional: </strong>".@$reg;
echo "<br /><br />";
echo "<strong>RPA: </strong>".@$rpa;
echo "<br /><br />";
echo "<strong>Tipo de Unidade : </strong>".@$tpu1;
echo "<br /><br />";
echo "<strong>Unidade de Ensino: </strong>".@$uni;
echo "<br /><br />";
echo "<strong>Modalidade de Ensino: </strong>".@$mod;
echo "<br /><br />";
echo "<strong>Ano de Ensino: </strong>".@$ano;
echo "<br /><br />";
echo "<strong>Turma: </strong>".@$turma;
echo "<br /><br />";
echo "<strong>Turno: </strong>".@$turno;
echo "<br /><br />";
echo "<strong>Situação da Turma: </strong>".@$situacaoTurma;
echo "<br /><br />";
echo "<strong> Matrícula do Professor Titular: </strong>".@$matricula;
echo "<br /><br />";
echo "<strong>CPF do Professor Titular: </strong>".@$matricula;
echo "<br /><br />";
echo "<strong>Nome do Professor Titular: </strong>".@$nomeProfEfetivo;
echo "<br /><br />";
echo "<strong> Cargo do Professor Titular: </strong>".@$cargo;
echo "<br /><br /><br />";
echo "<h3>A turma já possui professor titular. Deseja alterar essa informação?</h3>";
echo "<html>
<head>
<link rel='stylesheet' type='text/css' href='/SLP/css/css/simenao.css' />
</head>
<body>
<div style='width:100px; float:left'>
<form name='alterarTurma' method='post' action='/SLP/cadastro de professor/pag3'>
<input type='submit' class='ct btn-blue' value='SIM' />
</form>
</div>
<div style='width:100px; float:left '>
<form name='removerTurmaMenu' method='post' action='/SLP/cadastro de professor/pag1'>
<input type='submit' class='ct btn-blue' value='NÃO' />
</form>
</div>
</body>
</html>";
}else {
echo "<strong>ID: </strong>".@$id;
echo "<br /><br />";
echo "<strong>Regional: </strong>".@$reg;
echo "<br /><br />";
echo "<strong>RPA: </strong>".@$rpa;
echo "<br /><br />";
echo "<strong>Tipo de Unidade: </strong>".@$tpu1;
echo "<br /><br />";
echo "<strong>Unidade de Ensino: </strong>".@$uni;
echo "<br /><br />";
echo "<strong>Modalidade de Ensino: </strong>".@$mod;
echo "<br /><br />";
echo "<strong>Ano de Ensino: </strong>".@$ano;
echo "<br /><br />";
echo "<strong>Turma: </strong>" .@$turma;
echo "<br /><br />";
echo "<strong>Turno: </strong>".@$turno;
echo "<br /><br />";
echo "<strong>Situação da Turma: </strong>".@$situacaoTurma;
echo "<br /><br /><br />";
echo "<html>
<head>
</head>
<body>
<form name='cadastroProf' method='post' action='/SLP/cadastro de professor/pag3'>
<link rel='stylesheet' href='/SLP/css/css/finalizar.css'>
<input type='submit' class='btfinalizar btn-blue' value='Incluir Professor' />
</form>
</body>
</html>";
}
}
else{
echo "<html>
<head>
<link rel='stylesheet' href='/SLP/css/css/Pag.css'>
</head>
<body>
<div class='container2'>
Turma não encontrada!
</div>
</body>
</html>";
}
?>
</br></br></br>
<link rel="stylesheet" href="/SLP/css/css/voltar.css">
<a href="/SLP/cadastro de professor/pag1" class="bt btn-blue">Voltar</a>
</body>
</html>
You’re talking about accents?
– Guilherme Nascimento
I noticed that using utf8_decode, if you need this function means that you have not configured the connection, or header, or Page Encounter properly. Should this be the case, either use iso-8859-1 or utf-8, once chosen follow step-by-step at https://answall.com/a/43205/3635 (change from utf8 to iso-8859-1/latin1 if not to use utf-8)
– Guilherme Nascimento
I did not understand much what you said I use the utf_decode so that the POST enter the database without breaking the characters with an f at the end harming my query extraction in the database. This change you suggested was in "Code" or was it somewhere else???
– Gilberto Mendes
Precisely, if you are using it is because the data is coming mixed together, vc did not define well, in case your scripts are mixing iso-88859-1 (or compatible) with utf-8 (Unicode). It’s not an exact thing you did. For it to work well you have to follow the step-by-step that I indicated to you on the link, because if you need the utf8_decode to treat the $_POST is because there is something very wrong.
– Guilherme Nascimento