Note that there are some explanatory texts on larger screens.

plurals
  1. POCorrect method to store option values in a select box
    primarykey
    data
    text
    <p>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. <a href="https://stackoverflow.com/questions/12300358/possible-to-run-db-update-function-when-dropdown-is-selected">Possible to run DB update function when dropdown is selected</a>.</p> <p>My code looks like:</p> <pre><code>echo '&lt;tr&gt;'; echo '&lt;td&gt;&lt;input type="text" name="order_no[]" value="' . $row['Orderno'] . '"/&gt;&lt;/td&gt;'; echo '&lt;td&gt;&lt;input type="text" name="order_date[]" value="' . $row['Orderdate'] . '"/&gt;&lt;/td&gt;'; echo '&lt;td&gt;&lt;input type="text" name="order_ordered_by[]" value="' . $row['Orderedby'] . '"/&gt;&lt;/td&gt;'; echo '&lt;td&gt;&lt;input type="text" name="order_supplier[]" value="' . $row['Supplier'] . '"/&gt;&lt;/td&gt;'; echo '&lt;td&gt;&lt;input type="text" name="order_total_price[]" value="' . $row['totalprice'] . '"/&gt;&lt;/td&gt;'; echo '&lt;td&gt;&lt;input type="text" name="order_requested_by[]" value="' . $row['requestedby'] . '"/&gt;&lt;/td&gt;'; echo '&lt;td&gt;'; echo '&lt;select id ="id" name="id"&gt;'; echo '&lt;option value = "1" class = "pending"&gt;Pending&lt;/option&gt;'; echo '&lt;option value = "2" class = "approved"&gt;Approved&lt;/option&gt;'; echo '&lt;option value = "3" class ="disapproved"&gt;Disapproved&lt;/option&gt;'; echo '&lt;/select&gt;'; echo '&lt;/td&gt;'; echo '&lt;/tr&gt;'; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload