# Adding and updating data to the database using the column names sent by POST

**URL:** <https://www.phphelp.com/t/adding-and-updating-data-to-the-database-using-the-column-names-sent-by-post/35096>\
**Category:** Beginners - Learning PHP\
**Created:** [November 2, 2022, 8:04am UTC](https://www.phphelp.com/t/adding-and-updating-data-to-the-database-using-the-column-names-sent-by-post/35096 "2022-11-02T08:04:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [November 2, 2022, 8:40am UTC](https://www.phphelp.com/t/adding-and-updating-data-to-the-database-using-the-column-names-sent-by-post/35096/2 "2022-11-02T08:40:40Z")

</div>

You were already told not to do that -

> [@Is it possible to post two separate values when an item is selected with the Select option?](https://www.phphelp.com/t/is-it-possible-to-post-two-separate-values-when-an-item-is-selected-with-the-select-option/35025/23):
>
> Databases are not speadsheets. You should only store data that exists. That table should have one row for each separate piece of product/property data.

And what to do -

> [@Is it possible to post two separate values when an item is selected with the Select option?](https://www.phphelp.com/t/is-it-possible-to-post-two-separate-values-when-an-item-is-selected-with-the-select-option/35025/25):
>
> You would have one product\_type(s) table. It would have columns for -
> 
> 1. an id (which you apparently have)
> 2. product\_id (which you apparently have)
> 3. type (which would be whatever the existing column names are)
> 4. value (which would be whatever the existing stored values are)

By laying out a table like a spreadsheet, every operation to find, order, count, insert, and update data requires more code and more complicated queries.

---

_[View the full topic](https://www.phphelp.com/t/adding-and-updating-data-to-the-database-using-the-column-names-sent-by-post/35096)._
