Hallo,
Ich habe ja jetzt einen guten script (aus dem Thema, dass ich grade für gelöst erklärt habe), aber sobald man in ein Formularfeld ein "ß" eingibt (was manchmal nötig ist), wird überhaupt nichts in die DB geschriben (sonst schon) und es wird folgende Fehlermeldung ausgespuvkt:
Code für das Formular:
thxb.php:
Ich vermute, das mit der Codierung etwas schiefläuft. Die Query, die ich mir schon durch var_dump() habe ausgeben lassen, macht in der Kommandozeile alles gut, dann wird auch das ? in die Tabelle geschrieben und alles ist super. Ich glaube daher, dass der Fehler bei der Codierung der Query abläuft, wenn die an die DB weitergegeben wird.
Danke, BELL
Ich habe ja jetzt einen guten script (aus dem Thema, dass ich grade für gelöst erklärt habe), aber sobald man in ein Formularfeld ein "ß" eingibt (was manchmal nötig ist), wird überhaupt nichts in die DB geschriben (sonst schon) und es wird folgende Fehlermeldung ausgespuvkt:
Code:
Incorrect string value: '\xDF' for column 'VORNAME' at row 1
Code für das Formular:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>BELL</title>
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 1650px;
height: 450px;
background-color: #FFFFFF;">
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 1600px;
height: 400px;
background-color: #77D4FF;">
<img style="margin: auto; width: 1600px;" src="Logo.png" alt="Logo">
</div>
</div>
</head>
<body bgcolor="#77D4FF">
<br>
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 700px;
height: 720px;
background-color: #FFFFFF;">
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 650px;
height: 450px;">
<br>
<form action="thxb.php" method="post">
<div style="margin-left:auto;
margin-right:auto;
width: 600px;
height: 450px;"><font face="Arial" size="6">Ihr Vorname: <input type="text" name="vorname" placeholder="Max" autofocus style="width: 300px; height: 36px; font-size: 30px; font-family: Arial;" required/></font>
<br>
<br>
<font face="Arial" size="6">Ihr Name: <input type="text" name="name" placeholder="Mustermann" style="width: 300px; height: 36px; font-size: 30px; font-family: Arial;" required/></font>
<br>
<br>
<font face="Arial" size="6">Ihre Strasse: <input type="text" name="straße" placeholder="Musterstrasse" style="width: 300px; height: 36px; font-size: 30px; font-family: Arial;" required/></font>
<br>
<br>
<font face="Arial" size="6">Ihre Hausnummer: <input type="number" name="hausnummer" min="1" steps="1" placeholder="42" style="width: 300px; height: 36px; font-size: 30px; font-family: Arial;" required/></font>
<br>
<br>
<br>
<br>
<br>
<input type="image" src="Absenden.png" alt="Absenden"></div>
</form>
</div>
</div>
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 650px;
height: 130px;
background-color: #FFFFFF;">
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 600px;
height: 100px;
background-color: #FFFFFF;">
<a href="/iisstart.htm">
<img style="margin: auto; width: 600px;" src="Back.png" alt="Zurück zur Hauptseite">
</a>
</div>
</div>
<br>
</body>
</html>
thxb.php:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>BELL - Brötchen Einfach Liefern Lassen!</title>
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 1650px;
height: 450px;
background-color: #FFFFFF;">
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 1600px;
height: 400px;
background-color: #77D4FF;">
<img style="margin: auto; width: 1600px;" src="Logo.png" alt="Logo">
</div>
</div>
</head>
<body bgcolor="#77D4FF">
<br>
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 650px;
height: 600px;
background-color: #FFFFFF;">
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 500px;
height: 650px;">
<font face="Agency FB" size="7">Ihre eingaben: <?php echo $_POST ?></font>
</div>
</div>
<br>
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 650px;
height: 130px;
background-color: #FFFFFF;">
<br>
<div style="margin-left:auto;
margin-right:auto;
width: 600px;
height: 100px;
background-color: #FFFFFF;">
<a href="/iisstart.htm">
<img style="margin: auto; width: 600px;" src="Back.png" alt="Logo">
</a>
</div>
</div>
<br>
<br>
<?php
$db = mysqli_connect("localhost", "php", "passwort", "bell");
if(!$db)
{
exit("Verbindungsfehler: ".mysqli_connect_error());
}
$query = "
INSERT INTO
feed
(
VORNAME,
NACHNAME,
EMAIL,
NACHRICHT
)
VALUES
(
'" . mysqli_real_escape_string($db, $_POST['vorname']) . "',
'" . mysqli_real_escape_string($db, $_POST['name']) . "',
'" . mysqli_real_escape_string($db, $_POST['email']) . "',
'" . mysqli_real_escape_string($db, $_POST['nachricht']) . "'
)
";
mysqli_query($db, $query) or die(mysqli_error($db));
?>
</body>
</html>
Ich vermute, das mit der Codierung etwas schiefläuft. Die Query, die ich mir schon durch var_dump() habe ausgeben lassen, macht in der Kommandozeile alles gut, dann wird auch das ? in die Tabelle geschrieben und alles ist super. Ich glaube daher, dass der Fehler bei der Codierung der Query abläuft, wenn die an die DB weitergegeben wird.
Danke, BELL