0

I ofc allready searched but can't find anything that works, even htmlentities is't working:

index.php:

<head>
<meta charset="utf-8">
</head>

<form action="upload.php" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
titel: <input style="width: 300px; margin-left: 104px;" type="text" name="titel">
<input type="submit" value="UPLOAD">
</form>

and upload.php:

<head>
<meta charset="utf-8">
</head>


<?php
if(isset($_POST['titel']))
{
    $con = mysqli_connect("localhost","trhdrth","fhrth","trhdrth");

    $titel = mysqli_real_escape_string($con, $_POST['titel']);

    mysqli_query($con, "INSERT INTO artikel (titel)
    VALUES ('" . $titel . "')");
}
?>

When titel is blablabla then everything i working but when it's смешные then it' not working

How to do it right?

Eddy Unruh
  • 576
  • 1
  • 5
  • 18
  • I've seen it but I don't know what this PDO is – Eddy Unruh Apr 18 '16 at 23:39
  • It's a different database API. Don't worry about it, since you're using mysqli. The answer to that question has instructions for both. – miken32 Apr 18 '16 at 23:41
  • I tried mysqli_set_charset($_POST['titel'], 'utf8mb4') now AND added to the head of index.php and upload.php AND accept-charset="UTF-8" to the form but it's still not working, what the hell is wrong with this POS I'm getting sick of it – Eddy Unruh Apr 18 '16 at 23:46
  • I edited the question by inserting everything now, what would be the solution? – Eddy Unruh Apr 19 '16 at 00:01
  • In addition to setting all the appropriate charsets / collations, you should also use a prepared statement with bound parameters to execute the insert. – Phil Apr 19 '16 at 00:16
  • What????????????????? – Eddy Unruh Apr 19 '16 at 00:29

0 Answers0