form data to json per php works!

This commit is contained in:
David Renner 2020-06-08 12:33:06 +02:00
parent b1526d2b42
commit 5bcfce5caa
2 changed files with 21 additions and 16 deletions

View file

@ -31,7 +31,7 @@ Das war die alte version. -->
<div class="Eingabe"> <div class="Eingabe">
<h2>Eingabe</h2> <h2>Eingabe</h2>
<form action="/php/catalogue_search.php"> <form action="./php/catalogue_search.php" method="POST">
<input type="text" name="Title" id="input" placeholder="Titel"> <input type="text" name="Title" id="input" placeholder="Titel">
<input type="text" name="Author" id="input" placeholder="Autor"> <input type="text" name="Author" id="input" placeholder="Autor">
<input type="text" name="Country" id="input" placeholder="Herkunft"> <input type="text" name="Country" id="input" placeholder="Herkunft">
@ -39,10 +39,20 @@ Das war die alte version. -->
<input type="text" name="Language" id="input" placeholder="Sprache"> <input type="text" name="Language" id="input" placeholder="Sprache">
<input type="number" name="Pages" id="input" placeholder="Seiten"> <input type="number" name="Pages" id="input" placeholder="Seiten">
<input type="date" name="Year" id="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY--> <input type="date" name="Year" id="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY-->
<input type="text" name="Category" id="input" placeholder="Kategorie"> <!-- Nur Auswahl (per select?) --> <input list="categories" name="Category" id="input" placeholder="Kategorie"> <!-- Nur Auswahl (per select?) -->
<datalist id="categories">
<option value="Buch">
<option value="Magazin">
<option value="E-Book">
<option value="e-Magazin">
</datalist>
<input type="url" name="ImageLink" id="input" placeholder="Bild"> <input type="url" name="ImageLink" id="input" placeholder="Bild">
<input type="number" name="LendTime" id="input" placeholder="Verteihdauer"> <input type="number" name="LendTime" id="input" placeholder="Verteihdauer">
<input type="text" name="LendType" id="input" placeholder="Verleihtyp"> <input list="types" name="LendType" id="input" placeholder="Verleihtyp">
<datalist id="types">
<option value="Physisch">
<option value="Virtuell">
</datalist>
<input type="submit" name="go" id="go"> <input type="submit" name="go" id="go">
</form> </form>
</div> </div>

View file

@ -1,14 +1,9 @@
<?php <html>
$form = array("Title"=>$_GET["Title"],array("Author"=>$_GET["Author"]);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body> <body>
echo json_encode($form); <?php
$form = array("Title"=>$_POST["Title"],"Author"=>$_POST["Author"]);
$form = json_encode($form);
echo $form
?>
</body> </body>
</html> </html>
?>