I want to send by the POST method only the data that is selected, including the name of the input and the quantity, how could I do it? I'm working with PHP and HTML, the data is in charge of the database.
Assuming that the elements you have in a <form>
, when you do the submit
of the form only those elements that do not have the attribute 'disabled' will be sent in the request.
Therefore, if you do not want a data to be sent, put the input element disabled before sending it.
It occurs to me that you can do this when you validate the form in javascript.
On the other hand, if you are sending it with ajax, well in that case you have total control of what is sent and what is not, so it is only a matter of determining if you add the variable to the POST or not.