Guten Morgen, Coders,
Ich werde nicht Schlau wo der Fehler ist, er sagt Zeile 37 ist Fehlerhaft wenn ich mir das Formular angucke finde ich keinen Fehler, ich hoffe ihr könnt mir Helfen.
Ich werde nicht Schlau wo der Fehler ist, er sagt Zeile 37 ist Fehlerhaft wenn ich mir das Formular angucke finde ich keinen Fehler, ich hoffe ihr könnt mir Helfen.
PHP:
<?phpinclude('config.inc.php'); // Config.inc.php einbinden
?><?phpif ($action == 'new') {$id = clean_it($_GET['id']); // Variable definieren if (isset($_POST['submit'])) { $frage = clean_it($_POST['frage']); $status = clean_it($_POST['status']);
if (empty($frage) || empty($status) || empty($_POST['antwort'])) { // Pruefen ob alles angegeben echo "<div class=\"error\"><h2>Error...</h2><p>Bitte danke alle Felder ausfuellen!</p></div>\n"; } else { // Sofern alles angegeben wurde // Frage in DB eintragen $umfrage = mysql_query("INSERT INTO grafixx_poll (frage, status, date) VALUES ('$frage','$status', now() )"); $poll_id = mysql_insert_id(); // POLL ID bestimmen if ($umfrage) { // sofern frage in DB eingetragen => Antworten in DB schreiben foreach($_POST['antwort'] as $antwort) { // antworten eintragen $eintragen = mysql_query("INSERT INTO grafixx_antworten (poll_id, antwort) VALUES ('$poll_id','$antwort')"); } }
if ($umfrage AND $eintragen) { // Sofern Eintrag geklappt hat header("Location: $pfad"); // Weiterleitung } else { // Wenn Eintrag nicht geklappt hat => Fehlermeldung echo "<div class=\"error\"><h2>Error ...</h2>\n"; echo "<p>Der Eintrag war leider nicht erfolgreich! " . mysql_error() . "</p>\n</div>\n"; } } // close alles angegeben} // close submit
?>// Formular ausgeben<?php< form action = "" method = "post" name = "form" > < legend > Umfrage erstellen</legend > < label > Frage</label> < input class = "long" name = "frage" type = "text" / > < br / > < label > Antworten</label > < ol id = "wo" > < li > < input name = "antwort[]" type = "text" / > < input class = "button small" onclick = "delete_input(this);" type = "button" value = "loeschen" / > </li > < li > < input name = "antwort[]" type = "text" / > < input class = "button small" onclick = "delete_input(this);" type = "button" value = "loeschen" / > </li ></ol > < input class = "button" onclick = "add_input();" type = "button" value = "Antwort hinzufuegen" / > < br / > < br / > < label class = "go_left" > Status:</label > < input class = "radio" name = "status" type = "radio" value = "aktiv" / >aktiv < input class = "radio" name = "status" type = "radio" value = "inaktiv" / >inaktiv < br / > < br class = "clear_left" / > < input class = "button" name = "submit" type = "submit" value = "Umfrage erstellen" / ></fieldset ></form >
?>