I insert some data from a php form to the database. When I enter greek characters the database shows strange characters.
I have in my HTML charset="utf-8"
I tried decoding the post values and then from strange characters it gives me ????
$.ajax({
url:postURL,
method:"POST",
data:$('#add_name').serialize(),
type: 'json',
success:function(data)
{
i=1;
var spot = document.getElementById('spot_name').value;
window.location.href = "<?php echo base_url("index.php/Spot_preview/spot_preview/");?>"+spot;
}
});
php
foreach ($_POST["date"] as $key => $date) {
$dur =$_POST['spot_duration'];
$cat = $_POST['category'][$key];
$price = $dur * $cat;
$spot_name = ($_POST['spot_name']);
$sql = "INSERT INTO spot(spot_duration,spot_type,spot_name,spot_link,customer_name,spot_date,spot_show,spot_time,spot_price,spot_category) VALUES ('".$_POST['spot_duration']."','".$_POST['spot_type']."','".$spot_name."','".$_POST['file_name_helper']."','".$_POST['customer_name']."','".$date."','".$_POST['show'][$key]."','".$_POST['time'][$key]."',$price,'".$_POST['category'][$key]."')";
$mysqli->query($sql);
}