wishthis/includes/pages/wishlist-product-add.php

56 lines
1.2 KiB
PHP
Raw Normal View History

2021-11-15 13:43:57 +00:00
<?php
/**
* wishlist.php
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
use wishthis\Page;
use Embed\Embed;
2021-11-15 13:55:05 +00:00
if (isset($_POST['url'], $_POST['wishlist'])) {
$database->query('INSERT INTO `products`
(`wishlist`, `url`) VALUES
(' . $_POST['wishlist'] . ', "' . $_POST['url'] . '")
;');
}
2021-11-15 13:43:57 +00:00
$url = 'https://www.amazon.de/Adventskalender-2020-Schokolade-Weihnachtskalender-346g/dp/B08CTTP5JX';
$embed = new Embed();
$info = $embed->get($url);
2021-11-15 13:55:05 +00:00
// https://github.com/oscarotero/Embed
// echo '<pre>';
// var_dump($info);
// echo '</pre>';
2021-11-15 13:43:57 +00:00
2021-11-15 13:55:05 +00:00
$page = new page(__FILE__, 'Add a product');
2021-11-15 13:43:57 +00:00
$page->header();
2022-01-13 13:15:43 +00:00
$page->navigation();
2021-11-15 13:43:57 +00:00
?>
<main>
2022-01-13 13:15:43 +00:00
<div class="ui container">
<div class="ui segment">
<h1 class="ui header">Add a product</h1>
<form class="ui form" method="post">
<div class="field">
<label>URL</label>
<input type="url" name="url" value="<?= $url ?>" />
</div>
<div class="field">
<label>Wishlist</label>
<input type="number" name="wishlist" value="1" />
</div>
2022-01-13 13:27:51 +00:00
<input class="ui primary button" type="submit" value="Add" />
2022-01-13 13:15:43 +00:00
</form>
</div>
</div>
2021-11-15 13:43:57 +00:00
</main>
<?php
$page->footer();