<form class="sign-up-form form" action="do_addfaucets" method="post">
<label class="form-label-wrapper">
<p class="form-label">Faucet Category</p>
<?php
// Получим данные категорий
$stmt = pdo()->prepare("SELECT * FROM `categories`");
$stmt->execute();
foreach($stmt as $row){
echo "<select name=" . $row["name"] . ">";
echo "<option value=". $row["id"] ." selected>" . $row["name"] . "</option>";
echo "</select>";
}
?>
</label>
<label class="form-label-wrapper">
<p class="form-label">Faucet Name</p>
<input class="form-input" type="text" placeholder="Enter name faucet" id="name" name="name" required>
</label>
<label class="form-label-wrapper">
<p class="form-label">Faucet Url</p>
<input class="form-input" type="text" placeholder="Enter faucet url" id="url" name="url" required>
</label>
<label class="form-label-wrapper">
<p class="form-label">Faucet Time</p>
<input class="form-input" type="text" placeholder="Enter faucet time" id="time" name="time" required>
</label>
<button class="form-btn primary-default-btn transparent-btn">Add</button>
</form>
value
из selected
отправить в запросе?<main class="page-center">
<article class="sign-up">
<h1 class="sign-up__title">Add Faucet</h1>
<form id="data" class="sign-up-form form" action="do_addfaucets" method="post">
<label class="form-label-wrapper">
<p class="form-label">Faucet Category</p>
<select name=".num." form="data">
<?php
// Получим данные категорий
$stmt = pdo()->prepare("SELECT * FROM `categories`");
$stmt->execute();
foreach($stmt as $row){
echo "<option value=". $row["id"] ." selected>" . $row["name"] . "</option>";
}
?>
</select>
</label>
<label class="form-label-wrapper">
<p class="form-label">Faucet Name</p>
<input class="form-input" type="text" placeholder="Enter name faucet" id="name" name="name" required>
</label>
<label class="form-label-wrapper">
<p class="form-label">Faucet Url</p>
<input class="form-input" type="text" placeholder="Enter faucet url" id="url" name="url" required>
</label>
<label class="form-label-wrapper">
<p class="form-label">Faucet Time</p>
<input class="form-input" type="text" placeholder="Enter faucet time" id="time" name="time" required>
</label>
<button class="form-btn primary-default-btn transparent-btn">Add</button>
</form>
</article>
</main>