Hallo.
Ich habe auf meiner HP ein Formular, dessen Daten in eine SQL Datenbank geschrieben werden sollen. Nur, wenn auch nur ein ' dort erscheint, wird der gesamte Datensatz nicht in Datenbank geschrieben. Warum? Wenn ich das mit PHPMyAdmin mache, klappt es reibunglos...
erfassen.php
hinzufuegen.php
Danke im voraus
Ich habe auf meiner HP ein Formular, dessen Daten in eine SQL Datenbank geschrieben werden sollen. Nur, wenn auch nur ein ' dort erscheint, wird der gesamte Datensatz nicht in Datenbank geschrieben. Warum? Wenn ich das mit PHPMyAdmin mache, klappt es reibunglos...
erfassen.php
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Songtext hinzufügen</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"> <!-- body,td,th { color: #000000; } --> </style></head> <body> <h2></h2> </p> </p> </p> <?php require("connect.php"); include("counting.php"); include("../layout/navi.inc.php"); $vorname=$_POST["vorname"]; $nachname=$_POST["nachname"]; $songtitel=$_POST["songtitel"]; $songtext=$_POST["songtext"]; $album=$_POST["album"]; $poster=$_POST["poster"]; $sql1="INSERT INTO lyrics (vor,name,titel,text,album,autor) VALUES ('$vorname','$nachname','$songtitel','$songtext','$album','$poster')"; mysql_query($sql1); mysql_close(); ?> Ihr Songtext wurde aufgenommen! </body> </html>
Code:
<?php include("connect.php"); include("counting.php"); include("../layout/navi.inc.php"); ?> <html> <head> <title>Songtext hinzufügen</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-image: url(../layout/background.jpg); background-color: #FFFFFF; } body,td,th { font-family: Courier New, Courier, mono; font-size: 12px; } --> </style> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--> </script> </head> <body> </p> </p> </p> </p> <p align="center"></p> <form method="POST" action="erfassen.php"> <table width="743" height="47" border="0"> <tr> <td width="275" height="17"> Vorname </td> <td width="458">Nachname oder Bandname </td> </tr> <tr> <td height="24"><input name="vorname" type="text" size="40" maxlength="80"></td> <td><input name="nachname" type="text" size="40" maxlength="80"></td> </tr> </table> <table width="742" border="0"> <tr> <td width="736">Songtitel</td> </tr> <tr> <td><input name="songtitel" type="text" size="40" maxlength="80"></td> </tr> </table> <table width="200" border="0"> <tr> <td>Songtext</td> </tr> <tr> <td><textarea name="songtext" cols="70" rows="15"></textarea></td> </tr> </table> ACHTUNG: Derzeit ist es noch nicht möglich Hochkommata ( ' ) in den Texten zu verwenden!!! </p> <table width="692" border="0"> <tr> <td width="686">Aus dem Album </td> </tr> <tr> <td><input name="album" type="text" size="40" maxlength="80"></td> </tr> </table> </p> <table width="689" border="0"> <tr> <td width="683"><div align="center">Dieser Songtext wurde gepostet von... </div></td> </tr> <tr> <td><div align="center"> <input name="poster" type="text" size="40" maxlength="80"> </div></td> </tr> </table> <input type="submit" name="submit" value="submit"> </p> </form> </body> </html>
Kommentar