Einzelnen Beitrag anzeigen
  #8  
Alt 17.06.2016, 13:02:12
Cason Cason ist offline
Anfänger
 
Registriert seit: Jun 2016
Alter: 26
Beiträge: 5
AW: mysql speichert Dropdwons nicht

Hier mein formular quelltext
HTML-Code:
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 STRICT//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml-strict.dtd">
<html xmlns= "http://w3.org/1999/xhtml" lang ="de">

<?php
	//Datenverbindung
	$Verbindung = mysql_connect ("localhost", "root");
	mysql_select_db("mitarbeiterformular");
	
	//Abteilung	Feld
	$Resultat = mysql_query("select * from tbl_abteilung");
	$DatenSatzAnzahl = mysql_num_rows ($Resultat);
	for ($Index=0; $Index < $DatenSatzAnzahl; $Index++)
	{
	$Datensatz = mysql_fetch_assoc($Resultat);
	$Feld[$Index]["Abteilung_ID"]= $Datensatz["Abteilung_ID"];
	$Feld[$Index]["Abteilung"]= $Datensatz["Abteilung"];	
	}
	
	
	//Standort Feld2
	$Resultat2 = mysql_query("select * from tbl_standort");
	$DatenSatzAnzahl2 = mysql_num_rows ($Resultat2);
	for ($Index=0; $Index < $DatenSatzAnzahl; $Index++)
	{
	$Datensatz2 = mysql_fetch_assoc($Resultat2);
	$Feld2[$Index]["Standort_ID"]= $Datensatz2["Standort_ID"];
	$Feld2[$Index]["Standort"]= $Datensatz2["Standort"];	
	}
	
	//Vorgesetzter Feld3
	$Resultat3 = mysql_query("select * from tbl_vorgesetzter");
	$DatenSatzAnzahl3 = mysql_num_rows ($Resultat3);
	for ($Index=0; $Index < $DatenSatzAnzahl; $Index++)
	{
	$Datensatz3 = mysql_fetch_assoc($Resultat3);
	$Feld3[$Index]["Vorgesetzter_ID"]= $Datensatz3["Vorgesetzter_ID"];
	$Feld3[$Index]["Vorgesetzter"]= $Datensatz3["Vorgesetzter"];	
	}
	
	//Unternehmen Feld4
	$Resultat4 = mysql_query("select * from tbl_unternehmen");
	$DatenSatzAnzahl4 = mysql_num_rows ($Resultat4);
	for ($Index=0; $Index < $DatenSatzAnzahl; $Index++)
	{
	$Datensatz4 = mysql_fetch_assoc($Resultat4);
	$Feld4[$Index]["Unternehmen_ID"]= $Datensatz4["Unternehmen_ID"];
	$Feld4[$Index]["Unternehmen"]= $Datensatz4["Unternehmen"];	
	}
	
	
	//Monitor Feld5
	$Resultat5 = mysql_query("select * from tbl_monitor");
	$DatenSatzAnzahl5 = mysql_num_rows ($Resultat5);
	for ($Index=0; $Index < $DatenSatzAnzahl5; $Index++)
	{
	$Datensatz5 = mysql_fetch_assoc($Resultat5);
	$Feld5[$Index]["Monitor_ID"]= $Datensatz5["Monitor_ID"];
	$Feld5[$Index]["Monitor"]= $Datensatz5["Monitor"];	
	}	
	
	mysql_close($Verbindung);
?>

<head>
	<title>Mitarbeiterformular</title>
	<meta http-equiv="Content-type" content="text/html; CHARSET=iso-8859-1" />
	<link rel="stylesheet" type="text/css" href="css/basic.css" media="screen" />
	<style type="text/css">
		body
		{
			font-size: 85%;
			font-family: "Verdana, Arial, Sans-Serif"
			text-align: left;
			background-color: #fff;
		
			}
		
		#wrap
		{
			width: 760px;
			margin: 0 auto;
			text-alighn: left;
		}
		
		#kopf
		{
			width: 760px;
			height: 145px;
			font-size: 25px ;
			text-align: right;
			background-color: #fff;
			/*
			border-top: 2px solid #999;
			border-bottem: 2px solid #999;
			border-right: 2px solid #999;
			border-left: 2px solid #999; 
			 */
		}
		
		#kopf-1
		{
			text-align: center;
			width: 760px;
			height: 60px;
		    border-top: 1px solid #fff;
			border-left: 1px solid #fff;
			border-right: 1px solid #fff;
		
		}
		
			#inhalt1
		{
			float: left;
			height: 100%;
			width: 760px;
			background-color: #fff;
			border-top: 2px solid #999;
			border-right: 2px solid #999;
			border-left: 2px solid #999; 
			border-bottem: 2px solid #999;
			 
		}
		
		
		#inhalt
		{
			float: left;
			height: 400px;
			width: 764px;
			background-color: #fff;
			border-top: 2px solid #999;
			/* border-right: 1px solid #999;
			border-left: 1px solid #999; */
			 
		}
		
		
		h2
		{
		text-align: center;
		}


		h3, h4, h5
		{
		margin: 12px;
		color: black;
		text-align: center;
		}
		
		
		h1
		{
		 front-size: 220%;
		 margin: 20px;
		 text-align: center;
		 color: black;
		}
		
		h6
		{
		margin: 11px;
		color: black;
		}
		
		p.dashed
		{border-style: dashed;
		margin: 15px 20px;
		}
		
		a:link
		{
		
		}
		
		a:hover, a:active, a:focus
		{
			color: #00ff00;
			text-decoration: none;
		}
			
		#navigation ul li
		{
		display: inline;
		list-style-type: none;
		margin: 20px;
		}
		
		#fusszeile
		{
			border-top: 2px solid black;
		}
		
	</style>
	<body>
		<div id="wrap">
			<div id="kopf" >
				<!-- Eine Ueberschrift oder Logo fuer die Webseite -->
				<a href ="https://www.deutsche-glasfaser.de" title="Srart">
			 <div align="center"> <img src="deutsche-glasfaser_b.svg" alt="Logo"> </div> </a>	
			
			</div> <!-- Ende von Kopf -->			
		<div id="kopf-1"> 
		   <h1> Mitarbeiterformular </h1>
		   <h2> Personelle Daten </h2>
		<h3> ◄ Für die Personalabteilung ► </h3>
		</div> <!-- ende des Kopf-1 -->
		<div id="inhalt1">
		  <!-- Beginn des Inhalteinss -->
			</br> </br> </br> </br> </br>
			<form action = "speicher.php" method = "post">
				<table>
					<tr>
						<td> Vorname </td>
						<td> 
							<input type="text" size="25" name="vorname" />
						</td>
				</tr>
				<tr>
					<td> Nachname </td>
					<td>
						<input type="text" size="25" name="nachname" />
					</td>
				</tr>
				<tr>
					<td> Position </td>
					<td>
						<input type="text" size="25" name="position" />
					</td>
				</tr>
				<tr>
					<td> Abteilung </td>
					<td>
						<select name="abteilung" size="0">
<?php
							for($Index=0; $Index < $DatenSatzAnzahl; $Index++)
							{	
								echo "<option value".$Feld[$Index]["Abteilung_ID"].">".$Feld[$Index]["Abteilung"]."</option>";
							}
?>
						</select>
					</td>
				</tr>	
				<tr>
					<td> Vorgesetzter </td>
					<td>
						<select name="vorge" size="0">
<?php
							for($Index=0; $Index < $DatenSatzAnzahl; $Index++)
							{	
								echo "<option value".$Feld3[$Index]["Vorgesetzter_ID"].">".$Feld3[$Index]["Vorgesetzter"]."</option>";
							}
?>
						</select>
					</td>
				</tr>
				<tr>
					<td> Unternehmen </td>
					<td>
						<select name="unternehmen" size="0">
<?php
							for($Index=0; $Index < $DatenSatzAnzahl; $Index++)
							{	
								echo "<option value".$Feld4[$Index]["Unternehmen_ID"].">".$Feld4[$Index]["Unternehmen"]."</option>";
							}
?>
						</select>
					</td>
				</tr>
				<tr>
					<td> Standort </td>
					<td>
						<select name="standort" size="0">
<?php
							for($Index=0; $Index < $DatenSatzAnzahl; $Index++)
							{	
								echo "<option value".$Feld2[$Index]["Standort_ID"].">".$Feld2[$Index]["Standort"]."</option>";
							}
?>
						</select>
					</td>
				</tr>
				<tr>
					<td> B&uuml;ro </td>
					<td>
						<input type="text" size="25" name="buero" />
					</td>
				</tr>
				<tr>
					<td> Eintrittsdatum </td>
					<td>
						<input type="text" size="25" name="edatum" /> (tt.mm.jjjj)
					</td>
				</tr>
						<td> </td>
				<td>
					<input type="submit" value="Speichern" />
					<input type="reset" value="Abbrechen" />
				</td>
				</table>
			</form>		
</br>			
		</div> <!-- ende des Inhalt1 -->
		</body>
	</html>

ich weiß ich bin eine "einrückschlampe" und ich mache es wahrscheinlich auch bisschen umständlich. Trozdem denke ich das du das verstehst.

mit freundlichem gruß

Cason
Mit Zitat antworten