Add product

This commit is contained in:
Jay 2021-11-15 14:55:05 +01:00
parent 404a3c7ac7
commit 02e34365a5
2 changed files with 19 additions and 7 deletions

View file

@ -69,6 +69,8 @@ fieldset {
border: none;
}
input[type="number"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="text"] {

View file

@ -7,20 +7,25 @@
*/
use wishthis\Page;
use Brick\Schema\SchemaReader;
use Brick\Schema\Interfaces as Schema;
use Embed\Embed;
$page = new page(__FILE__, 'Add a product');
if (isset($_POST['url'], $_POST['wishlist'])) {
$database->query('INSERT INTO `products`
(`wishlist`, `url`) VALUES
(' . $_POST['wishlist'] . ', "' . $_POST['url'] . '")
;');
}
$url = 'https://www.amazon.de/Adventskalender-2020-Schokolade-Weihnachtskalender-346g/dp/B08CTTP5JX';
$embed = new Embed();
$info = $embed->get($url);
echo '<pre>';
var_dump($info->oembed);
echo '</pre>';
// https://github.com/oscarotero/Embed
// echo '<pre>';
// var_dump($info);
// echo '</pre>';
$page = new page(__FILE__, 'Add a product');
$page->header();
?>
<main>
@ -30,7 +35,12 @@ $page->header();
<form method="post">
<fieldset>
<label>URL</label>
<input type="url" name="url" />
<input type="url" name="url" value="<?= $url ?>" />
</fieldset>
<fieldset>
<label>Wishlist</label>
<input type="number" name="wishlist" value="1" />
</fieldset>
<input type="submit" value="Add" />