2
I’ve got a problem, I’ve encoded everything with utf-8, I’ve tried multiple ways to fix it and I can’t, in one <option>
of HTML, I pull a table from the database, but it returns with a special character symbol instead of the accents as in the photo below:
The code of <select>
is ésse
<select id="modalidade" name="modalidade" class="form-control">
<?php
header("Content-type:text/html; charset=utf-8");
//require_once ('../model/Conexao.php');
//mysql_set_charset('utf8');
$sql = "SELECT * FROM modalidade";
$cnx = mysqli_connect("localhost", "root", "", "olimpiada");
$resultado = mysqli_query($cnx,$sql,MYSQLI_STORE_RESULT);
$qtde = mysqli_num_rows($resultado);
if($qtde>0)
{
while($linha = mysqli_fetch_array($resultado))
{
echo "<option value=".$linha['idModalidade'].">";
echo $linha['modalidade'];
echo "</option>";
}
}
?>
</select>
Here is the database structure
Thanks in advance
The project is configured as utf-8 as well?
– Marcondes
Just for the record , o
header("Content-type:text/html; charset=utf-8");
should be before any HTML, you put in the middle of the HTML, this does not know recognize, unless you use ob_start (which can be an overuse without need), still it is best to organize the headers above all and before any output.– Guilherme Nascimento