I am currently working on a PHP website and I realized that the ς
character from the Greek alphabet is not being displayed in an input tag when I load it then name from a database.
I am also unable to input the ς
character into the text area.
I get this name:
Βασίλη
When the original name is this:
Βασίλης
This is the code for my input
element:
<input type="text" name="firstname" value= '<?= $client->name ?>'>
At first I assumed that the default encoding on HTML5 is UTF-8 although I wasn't sure if this is the case so I added this HTML tag to my page:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
This is the code in my profile.php
file:
<?php
$username = $_SESSION['username'];
$query = "SELECT * FROM `users` WHERE username= '$username'";
$result = $mysqli->query($query) or die(mysqli_error());
$client = $result->fetch_object();
?>
This is the code in my connli.php
file:
<?php
$mysqli = @new mysqli('localhost', 'root', '', '2661');
$mysqli->set_charset('utf8mb4');
if ($mysqli->connect_errno) {
die($mysqli->error);
}
?>