Answer the question
In order to leave comments, you need to log in
How to take select value in php?
All in one index.php file:
<?php
if (isset($_POST['priceSel'])) {
echo 'qwdwqdq';
}
?>
<select class="sel_price sel" id="priceSel" name="priceSel">
<option value="default">Default</option>
<option value="ascending">Ascending</option>
<option value="descending">Descending</option>
</select>
document.querySelector("#priceSel").addEventListener("change", function () {
fetch("", {
method: "post",
body: this.value,
});
});
Answer the question
In order to leave comments, you need to log in
so that the page is not updated, use ajax, then the form can also be used (only without submit, but just a button)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question