I am creating an inventory system for myself that contains a list of items (with description, count, last date used, etc.) that also contains a status for the item. At the most basic level, I am listing all items from a MySQL query (SELECT * FROM Items), along with their status in a SELECT HTML FORM element (int datatype, 0/1/2 status indicator).
I want to be able to update any item in this list without having to parse through every item that was listed and do a comparison against the SQL server's contents. I would imagine this is not the best practice and the better way to accomplish this would be to compile a list of items that are changing and submit them via HTTP POST. Is this correct? What would be the best way to accomplish this?
Use Ajax. Clean and simple. Fast way to implement is using JQuery.
<select id="target">
<option value="option1" selected="selected">Option 1</option>
<option value="option2">Option 2</option>
</select>
javascript
$('#target').change(function () {
$.ajax({
type: "POST",
url: "page.php",
data: 'id=something' ,
success: function (msg) {
//after php response
}
});
});
See change and ajax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With