82 lines
2.4 KiB
PHP
82 lines
2.4 KiB
PHP
|
<?PHP
|
|||
|
|
|||
|
include_once("init.php");
|
|||
|
|
|||
|
// von aussen kommt die Variable $mensch_id mit der Nummer des Menschen
|
|||
|
// bzw. sie ist nicht gesetzt f<>r einen Neuen
|
|||
|
|
|||
|
$monatsNamen= array("","Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
|
|||
|
|
|||
|
$geburtUnbekannt = false;
|
|||
|
|
|||
|
if (isset($mensch_id))
|
|||
|
{
|
|||
|
$result = mysql_query("SELECT * FROM Menschen WHERE mensch_id='$mensch_id'");
|
|||
|
$infos = mysql_fetch_array($result);
|
|||
|
if (isset($infos["Geburt"]) && strlen($infos["Geburt"]) > 0)
|
|||
|
list($gebJahr,$gebMonat,$gebTag) = explode("-",$infos["Geburt"]);
|
|||
|
else { $gebMonat = 1; $gebTag = 1; $gebJahr = 0; }
|
|||
|
settype($gebMonat,"integer");
|
|||
|
settype($gebTag,"integer");
|
|||
|
$geburtUnbekannt = (isset($infos["Geburt"]) && strlen($infos["Geburt"]) == 0);
|
|||
|
if (0 == $gebJahr) $gebJahr = "";
|
|||
|
$name = $infos["Name"];
|
|||
|
$vorname = $infos["Vorname"];
|
|||
|
}
|
|||
|
|
|||
|
if (!isset($mensch_id))
|
|||
|
{
|
|||
|
$id = -1;
|
|||
|
$gebTag = 1;
|
|||
|
$gebMonat = 1;
|
|||
|
$gebJahr = "";
|
|||
|
$name = "";
|
|||
|
$vorname = "";
|
|||
|
$geburtUnbekannt = false;
|
|||
|
$mensch_id = -1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
?>
|
|||
|
|
|||
|
<DIV ALIGN="CENTER">
|
|||
|
<form name="Mensch" action="edit_mensch.php?<?PHP print SID; ?>" method="post">
|
|||
|
<DIV ALIGN="CENTER">
|
|||
|
<table border="2" cellpadding="4" cellspacing="2">
|
|||
|
<tr> <td>Vorname: <input type="text" name="vorname"
|
|||
|
value="<?php echo $vorname; ?>"></td>
|
|||
|
<td>Name: <input type="text" name="name"
|
|||
|
value="<?php echo $name; ?>"></td></tr>
|
|||
|
<tr> <td colspan="2">Geburtsdatum:
|
|||
|
<select name="gebTag" size="1">
|
|||
|
<?php for ($zvalue=1; $zvalue<=31; $zvalue++)
|
|||
|
{
|
|||
|
echo "<OPTION VALUE=\"$zvalue\"";
|
|||
|
if ($zvalue == $gebTag) echo " SELECTED";
|
|||
|
echo ">$zvalue</OPTION>";
|
|||
|
} ?>
|
|||
|
</select>
|
|||
|
<select name="gebMonat" size="1">
|
|||
|
<?php for ($zvalue=1; $zvalue<=12; $zvalue++)
|
|||
|
{
|
|||
|
echo "<OPTION VALUE=\"$zvalue\"";
|
|||
|
if ($zvalue == $gebMonat) echo " SELECTED";
|
|||
|
echo ">$monatsNamen[$zvalue]</OPTION>";
|
|||
|
} ?>
|
|||
|
</select>
|
|||
|
<input type="text" name="gebJahr" size="5" maxlength="4"
|
|||
|
value="<?php echo $gebJahr; ?>">
|
|||
|
<INPUT TYPE="CHECKBOX" NAME="geburtUnbekannt"
|
|||
|
VALUE="unbekannt"
|
|||
|
<?PHP if ($geburtUnbekannt) print 'checked="checked"'; ?>
|
|||
|
>unbekannt</TD>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<input type="hidden" name="mensch_id" value="<?php echo $mensch_id; ?>"
|
|||
|
size="24">
|
|||
|
<DIV ALIGN="CENTER"><input type="submit" value="Eintragen"
|
|||
|
ACCESKEY=" " name="submitMensch"></DIV>
|
|||
|
|
|||
|
</FORM>
|
|||
|
</DIV>
|