<?php
$user_admin=$_COOKIE["user_admin"];
include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
require("FCKeditor/fckeditor.php") ;


// Rechte&uuml;berpr&uuml;fung
$db = dbconnect();
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
$result = $db->query("SELECT 1 FROM skik_admin_rechte, skik_admin_rechte_zuord , skik_admin where skik_admin_rechte.skik_admin_rolle = skik_admin_rechte_zuord.skik_admin_rolle AND skik_admin_rechte_zuord.faid = skik_admin.faid AND skik_admin.user = '$user_admin' AND skik_admin_rechte_zuord.skik_admin_rolle = 'a_skikerf'");
$row = $result->fetch_array();
if ($row[0] != 1){ include("kurs/rechte.php"); exit;}
// Rechte&uuml;berpr&uuml;fung ende

if (isset($_GET['action']))
   $action = $_GET['action'];
else
   $action = "";

switch($action){
default:
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Vertiefungsbereich erfassen</title>
</head>
<body onload=\"if(document.skik_erf)document.skik_erf.FPR_Nr.focus();return false;\">
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"650\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_top.gif\" valign=\"top\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <font class=\"hd\">Sprachkurs / Interkulturelle Kompetenzen erfassen</font><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></font></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td>
                    <form action="; echo $_SERVER['PHP_SELF'] . "?action=erfassen"; echo" method=\"POST\" name=\"skik_erf\">
                      <table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"border-width:0; border-collapse: collapse\" bordercolor=\"#111111\" width=\"102%\" id=\"AutoNumber1\" height=\"18\">
                        <tr>
                          <td width=\"40%\">
                          <b>Nr*:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"FPR_Nr\" size=\"3\">
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Bezeichnung*:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"Bezeichnung\" size=\"40\">
                          </td>
                        </tr>

                        <tr>
                          <td width=\"40%\">
                          <b>Ansprechpartner:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"Ansprechpartner\" size=\"40\">
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">

                          <b>Minimale Teilnehmer:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"min_t\" size=\"2\">
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Maximale Teilnehmer*:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"max_t\" size=\"2\">
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Jahrgang*:</b>
                          <font size=\"1\">(z.B. 03)</font>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"jahr\" size=\"2\"><font size=\"1\"> 2-stellige Jahresangabe!</font>
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\" valign=\"top\">
                          <b>zugelassene Zweige*:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"checkbox\" name=\"I\" value=\"I\"> Innenverwaltung</td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          &nbsp;</td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"checkbox\" name=\"R\" value=\"R\"> Rentenversicherung</td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          &nbsp;</td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"checkbox\" name=\"F\" value=\"F\"> Allgemeine Finanzverwaltung</td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          &nbsp;</td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"checkbox\" name=\"S\" value=\"S\"> Steuerverwaltung</td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Art*:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                           <label for=\"r1\"><input type=\"radio\" id='r1' name=\"art\" value='SK' size=\"55\"> Sprachkurs</label><br>
                           <label for=\"r2\"><input type=\"radio\" id='r2' name=\"art\" value='IK' size=\"55\"> Interkulturelle Kompetenzen</label><br>
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Niveau (* bei Sprachkursen):</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <select size=\"4\" name=\"niveau\">
                          <option value='A2 - B1'>A2 - B1&nbsp;&nbsp;&nbsp;</option>\n
                          <option value='B1 - B2'>B1 - B2&nbsp;&nbsp;&nbsp;</option>\n
                          <option value='B2 - C1'>B2 - C1&nbsp;&nbsp;&nbsp;</option>\n
                          <option value='C1 - C2'>C1 - C2&nbsp;&nbsp;&nbsp;</option>\n
                          </select>

                          </td>
                        </tr>
                        <tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Anzahl der Gruppen:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                           <input type=\"text\" name=\"gruppen\" size=\"55\">
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\" valign=\"top\">
                          <b>Dozent*:</b><br>
                          <font size=\"1\">(Strg-Taste f&uuml;r Mehrfachauswahl)</font>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          ";
                          $db = dbconnect();
                                $query = "SELECT doz_nr, doz_name, doz_vorname, doz_titel FROM doz order by doz_name";
                          $result = $db->query ($query)
                             or die ("Cannot execute query");
                          echo "<select size=\"4\" name=\"Dozent[]\" multiple>"; // In Dozent[] werden die ausgew&auml;hlen Values gespeichert: Bsp. [1], [3], [4]
                          while ($row = $result->fetch_array()){
                          echo "<option value=\"".$row[doz_nr]."\">".$row['doz_name'].",&nbsp;".$row['doz_vorname'].",&nbsp;&nbsp;&nbsp;".$row['doz_titel']."&nbsp;&nbsp;&nbsp;</option>\n";
                          }
                          echo "</select>";
                          echo "
                          </select><br>
                          <a href=\"doz_anleg.php\">Dozent erfassen</a>
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\" valign='top'>
                          <b>Termine / Zeitraum:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">
                          <input type=\"text\" name=\"termine\" size=\"55\"><br>
                          <table>
                          <tr>
                            <td><input type=\"checkbox\" name=\"termin_ausserhalb\" value=\"X\"></td><td>Die Veranstaltungstermine werden möglicherweise außerhalb der Hochschule Ludwigsburg stattfinden.</td>
                          </tr>
                          <tr>
                            <td><input type=\"checkbox\" name=\"reisekosten\" value=\"X\"></td><td>Reisekosten können erstattet werden.</td>
                          </tr>
                           </table>
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          <b>Inhaltsbeschreibung:</b>
                          </td>
                          <td width=\"60%\" align=\"left\">";
                          $oFCKeditor = new FCKeditor('kurzbeschreibung') ;
			  $oFCKeditor->BasePath = './FCKeditor/';
			  #$oFCKeditor->Value = 'Default text in editor';
			  $oFCKeditor->ToolbarSet = 'Basic';
			  $oFCKeditor->Width  = '100%' ;
			  $oFCKeditor->Height = '150' ;
			  $oFCKeditor->Create() ;
                          echo"
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          &nbsp;
                          </td>
                          <td width=\"60%\" align=\"left\">
                          &nbsp;
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          * = Pflichtfelder
                          </td>
                          <td width=\"60%\" align=\"left\">
                          &nbsp;
                          </td>
                        </tr>
                        <tr>
                          <td width=\"40%\">
                          &nbsp;
                          </td>
                          <td width=\"60%\" align=\"left\">
                          &nbsp;
                          </td>
                        </tr>
                      </table>
                    &nbsp; <input type=\"submit\" value=\"Abschicken\" name=\"B1\">
                      <input type=\"reset\" value=\"Zur&uuml;cksetzen\" name=\"B2\"></form>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";

break;
case "erfassen":
if ($_POST[I] == "" and $_POST[R] == "" and $_POST[F] == "" and $_POST[S] == ""){    // mind. 1 Zweig muss angegeben werden. Getrennt durch and
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Eingabefehler</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Eingabefehler</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Es muss mindestens 1 Zweig ausgef&uuml;llt werden</b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
exit;
}

if ($_POST[FPR_Nr] == "" or $_POST[art] == "" or $_POST[Bezeichnung] == "" or $_POST[max_t] == "" or $_POST[Dozent] == "" or $_POST[jahr] == ""){
echo"
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Eingabefehler</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Eingabefehler</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Die Pflichtfelder m&uuml;ssen mindestens ausgef&uuml;llt werden</b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
exit;
} // Ende wenn Pflichtfelder nicht ausgef&uuml;llt wurden

if ($_POST[art] == "SK" AND $_POST[niveau] == ""){
echo"
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Eingabefehler</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Eingabefehler</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Das Niveau bei Sprachkursen darf nicht leer sein!</b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
exit;
} // Ende wenn Pflichtfelder nicht ausgef&uuml;llt wurden


$db = dbconnect();
$abfr_Psnvorh = $db->query ("SELECT FPRNr FROM skik_kurs WHERE FPRNr=\"". $_POST['FPR_Nr']."\" and Jahr=\"". $_POST['jahr']."\""); // Es daf kein Kurs angelegt werden, wenn die Kursnr schon vorhanden ist.
$vorhanden = $abfr_Psnvorh->fetch_array();

if ($vorhanden != "") { // Wenn Vertiefungsbereich vorhanden, dann Fehlermeldung
echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Doppelerfassung</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Doppelerfassung</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Es gibt bereits ein Sprachkurs / Interkulturelle Kompetenzen mit der Nr. $_POST[FPR_Nr] im Jahr $_POST[jahr]</b>
                    </p>
                    <p align=\"center\"><a href=\"javascript:history.back()\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
exit;
} // Ende wenn Kurs vorhanden

$gruppen = $_POST['gruppen'];
$kurzbeschreibung = mysqli_escape_string($db,stripslashes( $_POST['kurzbeschreibung'] ));
$termine = $_POST['termine'];
$termin_ausserhalb = $_POST['termin_ausserhalb'];
$reisekosten = $_POST['reisekosten'];
$art = $_POST['art'];
$niveau = $_POST['niveau'];
$zweig = "$_POST[I]$_POST[R]$_POST[F]$_POST[S]";

$sql = $db->query("INSERT INTO skik_kurs ( FPRNr 
                                            ,Bezeichnung
                                            ,Ansprechpart
                                            ,TN_min
                                            ,TN_max
                                            ,Jahr
                                            ,Zweig
                                            ,niveau
                                            ,gruppen
                                            ,beschreibung
                                            ,termine
                                            ,termin_ausserhalb
                                            ,reisekosten
                                            ,art
                                           )
                                     VALUES 
                                           ( \"". $_POST['FPR_Nr']."\"
                                            ,\"". $_POST['Bezeichnung']."\"
                                            ,\"". $_POST['Ansprechpartner']."\"
                                            ,\"". $_POST['min_t']."\"
                                            ,\"". $_POST['max_t']."\"
                                            ,\"". $_POST['jahr']."\"
                                            ,'$zweig'
                                            ,'$niveau'
                                            ,'$gruppen'
                                            ,'$kurzbeschreibung'
                                            ,'$termine'
                                            ,'$termin_ausserhalb'
                                            ,'$reisekosten'
                                            ,'$art'
                                            )
                  ");
$sql_id = $db->query("select id from skik_kurs where FPRNr=\"". $_POST['FPR_Nr']."\" and Jahr = \"". $_POST['jahr']."\"");
$id = $sql_id->fetch_array();

$Dozent = $_POST[Dozent]; // Vom Formular gesendetes Objekt in Variable schreiben
for ($i=0;$i<sizeof($Dozent);$i++) {  // Schleife, der die Dozenten aufaddiert bis alle ausgew&auml;hlen abgearbeitet sind.
$sql = $db->query("INSERT INTO skik_doz ( id , doz_nr )VALUES ( '$id[id]', '$Dozent[$i]' )");

}


echo "
<html>
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" href=\"../styles_pc.css\" type=\"text/css\">
<title>Einbindung</title>
</head>
<body>
<table border=\"0\" style=\"border-collapse: collapse\" width=\"100%\" cellpadding=\"0\" height=\"100%\" id=\"table1\">
    <tr>
        <td>
        <div align=\"center\">
            <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">
                <tr>
                    <td width=\"10\" background=\"../images/box_e1.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"3%\" background=\"../images/box_top.gif\" valign=\"top\"></td>
                    <td width=\"95%\" background=\"../images/box_top.gif\">
                    <img height=\"10\" src=\"../images/blank.gif\" width=\"1\"><br>
                    <span class=\"sh\">Einbindung</span><br>
                    <img height=\"5\" src=\"../images/blank.gif\" width=\"1\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e2.gif\">
                    <img height=\"40\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td width=\"1%\" background=\"../images/box_l.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td colspan=\"2\"><br>
                    <p align=\"center\"><b>Der Sprachkurs / Interkulturelle Kompetenz wurde ins System eingebunden</b>
                    </p>
                    <p align=\"center\"><a href=\"erfassen.php\">
                    <img border=\"0\" src=\"../images/zurueck.gif\" width=\"77\" height=\"22\"></a><br>
                    </p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p></p>
                    <p><br>
                    </p>
                    </td>
                    <td width=\"1%\" background=\"../images/box_r.gif\">
                    <img height=\"1\" src=\"../images/blank.gif\" width=\"22\"></td>
                </tr>
                <tr>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"1%\" background=\"../images/box_e3.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"></td>
                    <td nowrap=\"nowrap\" align=\"left\" width=\"98%\" background=\"../images/box_bottom.gif\" colspan=\"2\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"8\"></td>
                    <td nowrap=\"nowrap\" align=\"right\" width=\"1%\" background=\"../images/box_e4.gif\">
                    <img height=\"16\" src=\"../images/blank.gif\" width=\"22\"> </td>
                </tr>
            </table>
        </div>
        </td>
    </tr>
</table>
</body>
</html>";
} // Ende Action Script
?>