<?php
$pdo = new PDO('mysql:host=localhost;dbname=aquarium', 'Mein_DB_Username', 'mein_DB_PW');
function holeFeld ($feld, $fnm, $fval)
{
$sql = "SELECT $feld FROM aqua WHERE $fnm='$fval'";
$ergebnis= ($pdo->query ($sql));
while($row = $ergebnis->fetch(PDO::FETCH_OBJ))
{return $row->$feld;
}
}
?>
<html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- TemplateBeginEditable name="doctitle" -->
<title>Unbenanntes Dokument</title>
<!--TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css">
<!-- body,td,th {
color: #FFFFFF;
}
body {
background-color: #02679D;
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
color: #CCCCCC;
}
--> </style></head>
<body> <form name="form1" method="GET" action="update.php">
<label>
Name:
<input name="name" type="text" id="name" value="<?php print holeFeld("name","id",$id); ?>">
</label>
<br>
<label>Gattung:
<input name="gattung" type="text" id="gattung" value="<?php print holeFeld("gattung","id",$id); ?>">
</label>
<br>
Geschlecht:
<label>
<input name="geschlecht" type="text" id="geschlecht" value="<?php print holeFeld("geschlecht","id",$id); ?>">
</label>
<br>
<p>
<label>
<input type="submit" name="Submit" value="ändern">
</label>
</p>
<p>
<input name="id" type="hidden" id="id" value="<? print $id; ?>">
</p> </form> <p> </p> </body>
</html>