Hallo Community,
ich hätte eine Frage bezüglich der Datenübernahme aus eine DropDown Liste.
auf der Hauptseite habe ich folgende Dropdownliste, welche durch eine Arrayvariable gefüllt wird.
Host.php:
Auf einer zweiten Seite soll das ausgewählte Element in einer Textbox vorgegeben werden.
host_edit.php:
Ich seh meinen Fehler aktuell leider nicht.
ich hätte eine Frage bezüglich der Datenübernahme aus eine DropDown Liste.
auf der Hauptseite habe ich folgende Dropdownliste, welche durch eine Arrayvariable gefüllt wird.
Host.php:
PHP-Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Host Config </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<br>
<div align="left"><table>
<tr>
<th>
<form action="host_edit.php" method="post"><input type="submit" name="host_edit" value="edit Host">
<?PHP
include_once('host_functions.php');
if (!empty($_POST['host']))
{
$Host = new Host;
$hostname = $Host->read_cfg_hostnames();
}
echo'<select name="host_select">';
foreach($hostname as $key=>$value)
{
echo'<option value="'.$value.'">'.$value.'</option>';
}
echo '</select>';
?>
<p>
</form>
</th>
</tr>
</table>
</body>
</html>
host_edit.php:
PHP-Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div align="left"><table>
<tr>
<th>
<form action="host_functions.php" method = "post" >
<p>Hostname: <input name="hostname" value=$_POST['host_select'] readonly="readoly"/> </p>
</th></tr>
<tr><th>
<p>IP: <input name="ip"/></p>
</th></tr>
<tr><th>
<?PHP
include_once('host_functions.php');
if (!empty($_POST['new_host']))
{
$Hostgroup = new Hostgroup;
$hostgroups = $Hostgroup->read_hostgroup();
}
echo'<select multi="multiple" name="hostgroup[]">';
foreach($hostgroups as $key=>$value)
{
echo '<option value="'.$value.'">' .$value. '</option>';
}
echo '</select>';
?>
</tr></th>
<tr><th>
<p>Alias: <input name="alias" /> </p>
</th></tr>
</form>
</table>
</body>
</html>
Ich seh meinen Fehler aktuell leider nicht.
Kommentar