Sorry to post a question which has already been posted, however I am really struggling to get this functionality to work. When I change a select box option value I want it to remain the same on page refresh or logout. Must I use AJAX/PHP to get this to work? I have tried to do this to no avail. Possible to run DB update function when dropdown is selected.
My code looks like:
echo '<tr>';
echo '<td><input type="text" name="order_no[]" value="' . $row['Orderno'] . '"/></td>';
echo '<td><input type="text" name="order_date[]" value="' . $row['Orderdate'] . '"/></td>';
echo '<td><input type="text" name="order_ordered_by[]" value="' . $row['Orderedby'] . '"/></td>';
echo '<td><input type="text" name="order_supplier[]" value="' . $row['Supplier'] . '"/></td>';
echo '<td><input type="text" name="order_total_price[]" value="' . $row['totalprice'] . '"/></td>';
echo '<td><input type="text" name="order_requested_by[]" value="' . $row['requestedby'] . '"/></td>';
echo '<td>';
echo '<select id ="id" name="id">';
echo '<option value = "1" class = "pending">Pending</option>';
echo '<option value = "2" class = "approved">Approved</option>';
echo '<option value = "3" class ="disapproved">Disapproved</option>';
echo '</select>';
echo '</td>';
echo '</tr>';
Sounds like the selected status should be an attribute of the order. So you should make an ajax call to PHP (or whatever your server-side language is) to update the status when the selectbox changes. And the selectbox itself should look something like:
I don’t think cookies should be necessary