Thema: Kontaktbuch
-
13.03.2012, 16:25 #1
Kontaktbuch
Hallo liebe Community,
ich habe mir schnell eine Art Kontaktbuch in PHP geschrieben, weil es mir einfach besser gefällt als z.B. das von Windoof zu nutzen oder eins in .NET zu schreiben.
Wie gewohnt, OpenSource, macht damit was ihr wollt.
Design fehlt noch aber alle wichtigen Funktionen + SQL-Datei sind vorhanden.
LG
Download: contact 0.0.1.rar
Zeitaufwand: ca. 20 Minuten
___________________________
UPDATE:
edit.php
PHP-Code:<?php
error_reporting(0);
include('connection.php');
$id = mysql_real_escape_string($_GET['id']);
$abfrage = "SELECT * FROM contact WHERE id = '$id'";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
?>
<html>
<head>
<title>Eintrag bearbeiten</title>
</head>
<body>
<form action="#" method="post">
<table border="1">
<tr>
<th>Felder:</th>
<th>Angaben:</th>
</tr>
<tr>
<td>Vorname:</td>
<td><input type="text" name="vorname" value="<?php echo "$row->vorname"; ?>"></td>
</tr>
<tr>
<td>Nachname:</td>
<td><input type="text" name="nachname" value="<?php echo "$row->nachname"; ?>"></td>
</tr>
<tr>
<td>Spitzname:</td>
<td><input type="text" name="spitzname" value="<?php echo "$row->spitzname"; ?>"></td>
</tr>
<tr>
<td>Geburtsdatum:</td>
<td><input type="text" name="geburtsdatum" value="<?php echo "$row->geburtsdatum"; ?>"></td>
</tr>
<tr>
<td>Wohnort:</td>
<td><input type="text" name="wohnort" value="<?php echo "$row->wohnort"; ?>"></td>
</tr>
<tr>
<td>Telefonnummer:</td>
<td><input type="text" name="telefon" value="<?php echo "$row->telefon"; ?>"></td>
</tr>
<tr>
<td>Handynummer:</td>
<td><input type="text" name="handy" value="<?php echo "$row->handy"; ?>"></td>
</tr>
<tr>
<td>Email-Adresse:</td>
<td><input type="text" name="email" value="<?php echo "$row->email"; ?>"></td>
</tr>
</table>
<input type="submit" name="submit" value="Eintrag bearbeiten">
</form>
</body>
</html>
<?php
}
if ($_POST['submit'])
{
$vorname = mysql_real_escape_string($_POST['vorname']);
$nachname = mysql_real_escape_string($_POST['nachname']);
$spitzname = mysql_real_escape_string($_POST['spitzname']);
$geburtsdatum = mysql_real_escape_string($_POST['geburtsdatum']);
$wohnort = mysql_real_escape_string($_POST['wohnort']);
$telefon = mysql_real_escape_string($_POST['telefon']);
$handy = mysql_real_escape_string($_POST['handy']);
$email = mysql_real_escape_string($_POST['email']);
$aendern = "UPDATE contact Set
vorname = '$vorname',
nachname = '$nachname',
spitzname = '$spitzname',
geburtsdatum = '$geburtsdatum',
wohnort = '$wohnort',
telefon = '$telefon',
handy = '$handy',
email = '$email'
WHERE id = '$id'";
$update = mysql_query($aendern);
if ($update == true)
{
header("Location: profile.php?id=$id");
}
else
{
echo 'Fehler: ' . mysql_error();
}
}
?>
PHP-Code:<?php
include('connection.php');
$id = mysql_real_escape_string($_GET['id']);
$abfrage = "SELECT * FROM contact WHERE id = '$id'";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
echo "<table border=1>";
echo "<tr>";
echo "<th>Felder:</th>";
echo "<th>Angaben:</th>";
echo "</tr>";
echo "<tr>";
echo "<td>ID:</td>";
echo "<td>$row->id</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Vorname:</td>";
echo "<td>$row->vorname</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Nachname:</td>";
echo "<td>$row->nachname</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Soitzname:</td>";
echo "<td>$row->spitzname</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Geburtsdatum:</td>";
echo "<td>$row->geburtsdatum</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Wohnort:</td>";
echo "<td>$row->wohnort</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Telefonnummer:</td>";
echo "<td>$row->telefon</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Handynummer:</td>";
echo "<td>$row->handy</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Email-Adresse:</td>";
echo "<td>$row->email</td>";
echo"</tr>";
echo "<tr>";
echo "<td>Ändern:</td>";
echo "<td><a href=edit.php?id=$row->id>hier klicken.</a></td>";
echo"</tr>";
echo "<tr>";
echo "<td>Löschen:</td>";
echo "<td><a href=delete.php?id=$row->id>hier klicken.</a></td>";
echo"</tr>";
echo "</table>";
echo "<hr>";
echo "<a href=index.php>Startseite</a>";
}
?>Geändert von Snees (13.03.2012 um 16:56 Uhr)
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.