I have this html code and I want when I select name from table category with export.php to export all the data only for this category name.Can you help me please?
<select> <option disabled selected></option> <?php include "config.php"; // $products_cat = mysqli_query($con, "SELECT name From category"); while ($product_categoty = mysqli_fetch_array($products_cat)) { echo "<option value='" . $product_categoty['name'] . "'>" . $product_categoty['name'] . "</option>"; } ?> </select> <form method="post" action="export.php"> <input type="submit" name="expo" value="Export Category"> </form> </form>```
Advertisement
Answer
I think Select should be inside the form and please follow these steps to export data as csv. https://www.codexworld.com/export-data-to-csv-file-using-php-mysql/