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; border: none;
} }
input[type="number"],
input[type="url"],
input[type="email"], input[type="email"],
input[type="password"], input[type="password"],
input[type="text"] { input[type="text"] {

View file

@ -7,20 +7,25 @@
*/ */
use wishthis\Page; use wishthis\Page;
use Brick\Schema\SchemaReader;
use Brick\Schema\Interfaces as Schema;
use Embed\Embed; 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'; $url = 'https://www.amazon.de/Adventskalender-2020-Schokolade-Weihnachtskalender-346g/dp/B08CTTP5JX';
$embed = new Embed(); $embed = new Embed();
$info = $embed->get($url); $info = $embed->get($url);
echo '<pre>'; // https://github.com/oscarotero/Embed
var_dump($info->oembed); // echo '<pre>';
echo '</pre>'; // var_dump($info);
// echo '</pre>';
$page = new page(__FILE__, 'Add a product');
$page->header(); $page->header();
?> ?>
<main> <main>
@ -30,7 +35,12 @@ $page->header();
<form method="post"> <form method="post">
<fieldset> <fieldset>
<label>URL</label> <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> </fieldset>
<input type="submit" value="Add" /> <input type="submit" value="Add" />