0

I am currently trying to figure out how to pass the selected variable in a select menu to the checkout process that was built in OpenCart. I did view their documentation and forum beforehand. Only answers were for "multiple" variables being passed in the select menu but not the SELECTED option. I tried some JS and PHP methods before asking but it would either ignore the checkout page or keep going to the first value.

By default, it automatically increments at $5 being the form's hidden input value and first option. I want to pass that and make sure the selected amount outputs the correct dollar amount correctly on the checkout page. The option values go from 70 to 77.

Any help would be greatly appreciated.

<form name="reservation-form" method="POST" action="reservations/index.php?route=checkout/cart/reserve">
  <input type="hidden" name="product_id" value="70"> 
    <select id="quantity" name="quantity" onchange="this.form.submit()">
      <option selected>Select</option>
      <option name="1" value="1">5</option>
      <option name="2" value="2">10</option>
      <option name="3" value="3">20</option>
      <option name="4" value="4">75</option>
      <option name="5" value="5">100</option>
      <option name="6" value="6">200</option>
      <option name="7" value="7">500</option>
      <option name="7" value="8">1000</option>
   </select>
</form>
  • did you look up: [Get selected value in dropdown list using JavaScript?](http://stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript) - can you also provide the JS you have tried? – Felix Haeberle Apr 24 '17 at 22:09
  • Some very good information in that thread but none covered the onchange property when it acts as a submit button. I have specific values set up for this checkout process and we want to be able to pass by the first value and get the other values when that specific amount is selected. – J Singer Apr 25 '17 at 16:27
  • This is what I tried referencing this thread: http://stackoverflow.com/questions/25163030/how-to-submit-form-with-selected-value-when-i-use-onchange – J Singer Apr 25 '17 at 16:57

0 Answers0