codekasten/notiz-datenbank/edit_notiz_formular.php

48 lines
1.1 KiB
PHP

<?PHP
// von aussen kommt die Variable $notiz_id mit der Nummer des Notiz-Eintrags
// bzw. sie ist nicht gesetzt für einen Neuen
// ausserdem wird die $mensch_id uebergeben
include_once("init.php");
importPOST("notiz_id");
if (!isset($notiz_id)) $notiz_id = -1;
// falls eine bestehende Nummer bearbeitet werden soll
if ($notiz_id > -1)
{
$result = mysql_query("SELECT * FROM Notizen WHERE notiz_id='$notiz_id'");
$infos = mysql_fetch_array($result);
$notiz = $infos["Notiz"];
}
else
// eine neue Nummer wird angelegt
$notiz = "";
?>
<P>
<DIV ALIGN="CENTER">
<form name="Notiz" action="edit_notiz.php?<?PHP print SID; ?>" method="post">
<DIV ALIGN="CENTER">
<table border="2" cellpadding="4" cellspacing="2">
<tr> <td>Notiz: <input type="text" name="notiz"
SIZE="35" value="<?PHP echo $notiz; ?>">
</TD></TR>
</table>
</DIV>
<input type="hidden" name="notiz_id" value="<?php echo $notiz_id; ?>">
<INPUT TYPE="HIDDEN" NAME="submitNotiz" VALUE="edit">
<INPUT TYPE="hidden" NAME="mensch_id"
VALUE="<?PHP print $mensch_id; ?>">
<DIV ALIGN="CENTER"><input type="submit" value=" Eintragen "
ACCESKEY="&#13;"></DIV>
</FORM>
</DIV>