yesterday it took me nearly 4 hours to fix this php code.. im a beginner in php, so i don't have the experience to find the bug in this code.
the .php give me no errors, i also wrote this two lines at the begin:
error_reporting(E_ALL | E_STRICT);
´
ini_set('display_errors', TRUE);
and this is my php code:
//Variablen zuweisen
$name = filter_input(INPUT_POST, 'name');
$email = filter_input(INPUT_POST, 'email');
$betreff = filter_input(INPUT_POST, 'betreff');
$message = filter_input(INPUT_POST, 'message');
/*if (($vorname == "") OR ($nachname == "") OR($email == "")) {
echo "Fehler: Eintrag unvollständig.";
die;
}*/
//Verbindung herstellen
$datenbank = mysql_connect("*******", "****", "*****") or die ("Verbindung fehlgeschlagen: ".mysql_error());
$verbunden = mysql_select_db("4109932db1") or die ("Datenbank nicht gefunden oder fehlerhaft");
//Daten in DB speichern
$sql_befehl = mysql_query("INSERT INTO Contact_Requests (Name,Mail,Betreff,Message) VALUES ($name, $email, $betreff, $message");
if($sql_befehl)
{ echo "Ihr Eintrag wurde hinzugefügt."; }
//Verbindung beenden
mysql_close($datenbank);
this is my html code, i have a formular and this should send data to my php file (insert.php)
<form method="post" action="insert.php">
<table>
<tr>
<td>Name:*</td><td><input type="text" value="Name" id="name" onfocus="nameDel();" onblur="nameSet();" name="name" ></td>
</tr>
<tr>
<td>E-Mail:*</td><td><input type="email" value="E-Mail" id="email" onfocus="emailDel();" onblur="emailSet();" name="email"></td>
</tr>
<tr>
<td>Betreff:*</td><td><input type="text" value="Grund der Nachricht" id="regard" onfocus="regardDel();" onblur="regardSet();" name="betreff"></td>
</tr>
</table>
<p>
Nachricht:*<br><textarea cols="50" rows="10" id="msg" onfocus="msgDel();" onblur="msgSet();" name="message">Deine Nachricht</textarea>
</p>
<p>
<input type="submit" value="Senden" id="send" onclick="sendContact();">
</p>
</form>