FrontendDavid/findVerleih.php
Naumann 560252464b -
2020-06-12 08:57:44 +02:00

73 lines
2.2 KiB
PHP

<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/leihvorgang';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST'
),
);
$context = stream_context_create($options);
//echo $context;
$id= $_POST["id"];
$result = file_get_contents('http://localhost:5000/api/leihvorgang/'.$id);
//echo $result;
$json= json_decode($result, true);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verleih</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Verleih</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form methode="post">
<input type="number" name="id" class="input" placeholder="Geben sie die gesuchte VerleihId an" min= "0">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">Id</td>
<td><?php if(isset($_POST["go"])) echo $json['id']; ?></td>
</tr>
<tr>
<td class="fix">ItemId</td>
<td><?php if(isset($_POST["go"])) echo $json['itemId']; ?></td>
</tr>
<tr>
<td class="fix">ReturnDate</td>
<td><?php if(isset($_POST["go"])) echo $json['returnDate']; ?></td>
</tr>
<tr>
<td class="fix">Customer</td>
<td><?php if(isset($_POST["go"])) echo $json['customer']; ?></td>
</tr>
<tr>
<td class="fix">Returned</td>
<td><?php if(isset($_POST["go"])) echo $json['returned']; ?></td>
</tr>
</table>
</div>
</body>
</html>