adress.js
function addAdress(){
var s = document.getElementById('addStreetName').value;
var sn = document.getElementById('addStreetNumber').value;
var sl = document.getElementById('addStreetLittera').value;
var sz = document.getElementById('addZipCode').value;
var sa = document.getElementById('addAreaCode').value;
$.ajax({
url: 'db/addAdress.inc.php',
type:'POST',
dataType: 'json',
data: {
addStreetName: s,
addStreetNumber: sn,
addStreetLittera: sl,
addZipCode: sz,
addAreaCode: sa
},
success: function(output_string){
$('#addAdressResultBox').append(output_string);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
addAdress.inc.php
include('../inc/conn.inc.php');
$query = "INSERT INTO comhem_profiler_adresses (comhem_profiler_adresses_street, comhem_profiler_adresses_street_number, comhem_profiler_adresses_littera, comhem_profiler_adresses_zip_code, comhem_profiler_adresses_area_code)
VALUES ('" . $_POST['addStreetName'] . "', '" . $_POST['addStreetNumber'] . "', '" . $_POST['addStreetLittera'] . "', '" . $_POST['addZipCode'] . "', '" . $_POST['addAreaCode'] . "'";
$addAdress = mysql_query($query) or die(mysql_error());
mysql_close();
In this script I want to add adresses to the database. But when they end up in the database the special characters å ä ö en up as completly other charcters. Sörbyvägen ends up like Sörbyvägen. I do not know where to look the change this.
It does not seem to be the database as i took a script to change these to their html counterparts. Sörbyvägen still appeard in the database but with the html counterparts. And tried htmlspecialchars(). Still appeared as Sörbyvägen in the database.
Any idea?