1
I am learning PHP and I am facing some problems with the special characters, see:
the funny thing is that in the table items it displays the accent and the special characters.
And yes, I’ve tried using the settings <meta charset="UTF-8"/>
and also
<?php ini_set('default_charset','UTF-8');?>
until the <meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
and
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
the problem still persists.
This is my main form:
<html>
<head>
<?phpini_set('default_charset','UTF-8');?>
<title>Gerenciação de Tarefas</title>
</head>
<body>
<h2>Gerenciador de Tarefas</h2>
<?php include('formulario.php'); ?>
<?php if ($exibir_tabela) : ?>
<?php include('tabela.php'); ?>
<?php endif; ?>
</body>
</html>
This is the registration form:
<meta charset="UTF-8"/>
<form>
<fieldset>
<legend><b>Nova tarefa</b></legend>
<?php
$_id = $tarefa["id"];
$_nome = $tarefa["nome"];
$_descricao = $tarefa["descricao"];
$_prioridade = $tarefa["prioridade"];
$_prazo = $tarefa["prazo"];
$_concluida = $tarefa["concluida"];
?>
<input type = "hidden" name = "id"
value = "<?php echo $_id; ?>" />
<label>
Tarefa
<br>
<input type = "text" name = "nome"
value = "<?php echo $_nome; ?>"/>
</label>
<br><br>
<label>
Descrição(Opcional)
<br>
<textarea name = "descricao"><?php echo $_descricao; ?></textarea>
</label>
<br><br>
<label>
Prazo(Opcional)
<br>
<input type = "text" name = "prazo"
value = "<?php echo traduz_data_para_view($_prazo); ?>"/>
</label>
<br><br>
<fieldset>
<legend>Prioridade</legend>
<label>
<input type = "radio" name = "prioridade" value = "1"<?php echo ($_prioridade == 1)?'checked':''; ?>/>
Baixa
<input type = "radio" name = "prioridade" value = "2" <?php echo ($_prioridade == 2)?'checked':''; ?>/>
Média
<input type = "radio" name = "prioridade" value = "3"<?php echo ($_prioridade == 3)?'checked':''; ?>/>
Alta
</label>
</fieldset>
<br><br>
<label>
<input type = "checkbox" name = "concluida" value = "1" <?php echo ($_concluida == 1)?'checked':''; ?>/>
Tarefa Concluída
</label>
<br><br>
<input type = "submit" value = "<?php echo ($tarefa["id"] > 0) ? "Atualizar" : "Cadastrar"; ?>"/>
</fieldset>
</form>
This is the form of the table:
<meta charset="UTF-8"/>
<form>
<fieldset>
<table border = 1>
<tr>
<th>Tarefas</th>
<th>Descrição</th>
<th>Prazo</th>
<th>Prioridade</th>
<th>Concluída</th>
<th>Opções</th>
</tr>
<?php if($lista_tarefas != null){
foreach ($lista_tarefas as $tarefa) : ?>
<tr>
<td><?php echo $tarefa["nome"]; ?></td>
<td><?php echo $tarefa["descricao"]; ?></td>
<td><?php echo traduz_data_para_view($tarefa["prazo"]); ?></td>
<td><?php echo traduz_prioridade($tarefa["prioridade"]); ?></td>
<td><?php echo traduz_concluida($tarefa["concluida"]); ?></td>
<td>
<a href="editar.php?id=<?php echo $tarefa["id"];?>">
Editar
</a>
</td>
</tr>
<?php endforeach;
};?>
</table>
</fieldset>
</form>
This started when I separated the form for better maintenance, the 3 forms are up there!
Let’s go continue this discussion in chat.
– Julio Cesar da Silva Barros