so basically i have the following code in php
:
mysqli_query($connect,"SET NAMES 'utf8'");
mysqli_query($connect,"SET CHARACTER SET utf8");
mysqli_query($connect,"SET COLLATION_CONNECTION = 'utf8_unicode_ci'");
in html
:
<form method="post" accept-charset="utf-8">
<div class="input-group">
<input id="name" type="text" class="form-control" name="name" value="<?php print $data["name"]; ?>" placeholder="<?php print $data["name"]; ?>">
</div>
</form>
javascript :
var name = $('#name').val();
var surname = $('#surname').val();
var phone_number = $('#phone_number').val();
var GSM = $('#GSM').val();
var mail = $('#mail').val();
var work = $('#work').val();
var pharmacy_name = $('#pharmacy_name').val();
var pharmacy_id = $('#pharmacy_id').val();
if($.trim(name).length > 0 && $.trim(surname).length > 0 && $.trim(phone_number).length > 0 && $.trim(GSM).length > 0 && $.trim(mail).length > 0 && $.trim(work).length > 0 && $.trim(pharmacy_name).length > 0 && $.trim(pharmacy_id).length > 0)
{
$.ajax({
url:"editProfileAction",
method:"POST",
data:{name:name, surname:surname},
cache:false,
....
i am using ajax
to edit mysql
db but characters such as ıİ,ğĞ are shown as ?? but characters 'çÇüÜ' works fine i tried 3 4 hours trying to fix it i couldn't find an error
Read this post from php the right way. For a complete UFT8 support you need to set:
At the php level: Put it at the top of your PHP script
<?php
// Tell PHP that we're using UTF-8 strings until the end of the script
mb_internal_encoding('UTF-8');
At the database level:
Your databse collation must be set : utf8mb4 character set and collation.
utf8mb4 character set for complete UTF-8 support, not the utf8 character set!
At the browser level , include
// Tell PHP that we'll be outputting UTF-8 to the browser
mb_http_output('UTF-8');
and for the html part
<meta charset="UTF-8">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.