save
This commit is contained in:
47
app/view/kunde-save.php
Normal file
47
app/view/kunde-save.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
include '../head.php';
|
||||
|
||||
|
||||
|
||||
include '../connect.php';
|
||||
|
||||
$id= $_POST['id'];
|
||||
$gender = $_POST['Geschlecht'];
|
||||
$vorname = $_POST['Vorname'];
|
||||
$nachname = $_POST['Nachname'];
|
||||
$geburtstag = date("Y-m-d",strtotime($_POST['Geburstag']));
|
||||
$tele = $_POST['Telefonnr_'];
|
||||
$haarstruktur = $_POST['Haarstruktur'];
|
||||
$haarlaenge = $_POST['Haarlaenge'];
|
||||
|
||||
|
||||
$query="
|
||||
UPDATE
|
||||
Kunde
|
||||
SET
|
||||
Geschlecht = ?,
|
||||
Vorname = ?,
|
||||
Geburstag = ?,
|
||||
Telefonnr = ?,
|
||||
Nachname = ?,
|
||||
Haarlaenge = ?,
|
||||
Haarstruktur = ?
|
||||
WHERE
|
||||
Kundenr = ?";
|
||||
$stmt=$sql->prepare($query);
|
||||
|
||||
|
||||
$stmt->bind_param("sssssisi",$gender,$vorname,$geburtstag,$tele,$nachname,$haarlaenge,$haarstruktur,$id);
|
||||
if ($stmt->execute()){
|
||||
echo '<h1>Kunden Gespeichert</h1>';
|
||||
} else{
|
||||
echo '<h1>Fehler bei Speicherung</h1>';
|
||||
echo $stmt->error;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
include '../tail.php';
|
||||
?>
|
||||
@@ -1,18 +1,92 @@
|
||||
<?php
|
||||
include '../head.php';
|
||||
echo '<h1>Kunden Ansicht</h1>';
|
||||
$id= $_GET['id'];
|
||||
echo "<h2>Kunde $id</h2>";
|
||||
include '../connect.php';
|
||||
?>
|
||||
<?php
|
||||
include '../head.php';
|
||||
echo '<h1>Kunden Ansicht</h1>';
|
||||
$id = $_GET['id'];
|
||||
|
||||
include '../connect.php';
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
echo "<h2>Kunde $id</h2>";
|
||||
|
||||
$stmp = $sql->prepare("select * from Kunde where Kundenr=?;");
|
||||
|
||||
$stmp->bind_param('i', $id);
|
||||
$stmp->execute();
|
||||
$result = $stmp->get_result();
|
||||
|
||||
if ($result->num_rows == 1) {
|
||||
$row = $result->fetch_assoc();
|
||||
$gender = $row['Geschlecht'];
|
||||
$vorname = $row['Vorname'];
|
||||
$nachname = $row['Nachname'];
|
||||
$geburtstag = $row['Geburstag'];
|
||||
$tele = $row['Telefonnr'];
|
||||
$haarstruktur = $row['Haarstruktur'];
|
||||
$haarlaenge = $row['Haarlaenge'];
|
||||
echo "<form action='kunde-save.php' method='post'>
|
||||
|
||||
<label for='gender'>ID: </label>
|
||||
<input type='text' id='id' name=id readonly=true value=$id> <br>
|
||||
|
||||
<label for='gender'>Geschlecht: </label><br>
|
||||
<select name='Geschlecht' id='gender'>
|
||||
";
|
||||
|
||||
|
||||
switch ($gender) {
|
||||
case "m":
|
||||
echo "<option value='w'>Weiblich</option>";
|
||||
echo "<option value='m' selected>Männlich</option>";
|
||||
echo "<option value='d' >Diverse</option>";
|
||||
break;
|
||||
case "w":
|
||||
echo "<option value='w' selected>Weiblich</option>";
|
||||
echo "<option value='m'>Männlich</option>";
|
||||
echo "<option value='d'>Diverse</option>";
|
||||
break;
|
||||
case "d":
|
||||
echo "<option value='w'>Weiblich</option>";
|
||||
echo "<option value='m'>Männlich</option>";
|
||||
echo "<option value='d' selected>Diverse</option>";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
echo "
|
||||
</select><br>
|
||||
<label for='fname'>Vorname: </label><br>
|
||||
<input type='text' id='fname' name='Vorname' value='$vorname'><br>
|
||||
<label for='lname'>Nachname: </label><br>
|
||||
<input type='text' id='lname' name='Nachname' value='$nachname'><br>
|
||||
<label for='start'>Geburtstag:</label><br>
|
||||
<input type='date' id='geburtstag' name='Geburstag'
|
||||
value='$geburtstag'><br>
|
||||
<label for='phone'>Telefonnummer: </label><br>
|
||||
<input type='tel' id='phone' name='Telefonnr.'
|
||||
pattern='+[0-9]{3}-[0-9]{3}-[0-9]{4}'
|
||||
value='$tele'>
|
||||
<br>
|
||||
<label for='laenge'>Haarlänge: </lable><br>
|
||||
<input name='Haarlaenge' type='number' id='laenge' value='$haarlaenge'><br>
|
||||
<label for='haar'>Haarstruktur: </lable><br>
|
||||
<input name='Haarstruktur' type='text' id='haar' value='$haarstruktur'><br>
|
||||
<p><input type='submit'/></p>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
include '../tail.php';
|
||||
include '../tail.php';
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user