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

61 lines
No EOL
1.7 KiB
PHP

<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/inventar';
// 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["ItemId"];
$result = file_get_contents('http://localhost:5000/api/inventar/'.$id);
$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>Inventar</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>Inventar</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form method="post">
<input type="number" name="ItemId" class="input" placeholder="Geben Sie die gesuchte Id an" min= "1">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ItemId</td>
<td><?php if(isset($_POST["go"])) echo $json['itemId']; ?></td>
</tr>
<tr>
<td class="fix">BookId</td>
<td><?php if(isset($_POST["go"])) echo $json['bookId']; ?></td>
</tr>
</table>
</div>
</body>
</html>