Skip to content

Commit

Permalink
Resolucao de problema no charset da apresentacao das questoes
Browse files Browse the repository at this point in the history
Os caracteres especiais eram apresentado sem formatacao na apresentacao das questoes
Utilizei a funcao nativa do php utf8_encode para resolver o retorno das palavras com
caracteres especiais da base de dados
  • Loading branch information
Samuel Xavier committed Jul 17, 2019
1 parent c8673fe commit c57daba
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions public/questions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
require 'connection.php';
require 'links_externos/links.php';
session_start();
Expand All @@ -8,40 +8,43 @@

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Teste de Habilidade PHP</title>
</head>
<body>
<div class="container">
<h1 class="text-center text-primary">Questionário</h1>
<form action="result_test.php" method="post">
<?php foreach($questions as $question): ?>
<fieldset class="border" style="margin-bottom:10px">
<table class="table table-hover table-striped">
<thead>
<th>Questão <?= $question['question_id']?></th>
</thead>
<tbody>

<head>
<meta charset="UTF-8">
<title>Teste de Habilidade PHP</title>
</head>

<body>
<div class="container">
<h1 class="text-center text-primary">Questionário</h1>
<form action="result_test.php" method="post">
<?php foreach ($questions as $question) : ?>
<fieldset class="border" style="margin-bottom:10px">
<table class="table table-hover table-striped">
<thead>
<th>Questão <?= $question['question_id'] ?></th>
</thead>
<tbody>
<tr>
<td><?= utf8_encode(nl2br($question['question_description'])) ?></td>
</tr>
<?php foreach ($answers as $k => $answer) : ?>
<tr>
<td><?= nl2br($question['question_description']) ?></td>
<?php if ($answer['question_id'] == $question['question_id']) : ?>
<td>
<input type="radio" name="<?= $question['question_id'] ?>" value="<?= $answer['answer_id'] ?>">
<?= utf8_encode($answer['answer_description']) ?>
</td>
<?php endif ?>
</tr>
<?php foreach($answers as $k => $answer): ?>
<tr>
<?php if($answer['question_id'] == $question['question_id']): ?>
<td>
<input type="radio" name="<?= $question['question_id'] ?>" value="<?= $answer['answer_id'] ?>">
<?= $answer['answer_description'] ?>
</td>
<?php endif ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</fieldset>
<?php endforeach; ?>
<button class="btn btn-primary" style="margin-bottom:10px" >Enviar Respostas</button>
</form>
</div>
</body>
<?php endforeach ?>
</tbody>
</table>
</fieldset>
<?php endforeach; ?>
<button class="btn btn-primary" style="margin-bottom:10px">Enviar Respostas</button>
</form>
</div>
</body>

</html>

0 comments on commit c57daba

Please sign in to comment.