get data from database to the text field
I have 2 text fields, where it should shows the data from the database. I also have a dropdown list (Region) & currency type (currency).
so when I select the region from the dropdown list, the currency changes accordingly. like if I choose US, the currency should change to USD, for UK its changes to GBP, for EU it changes to EUR, but for the rest it is USD but the prices are different for all the region. here is the code for the region & currency.
- <script type="text/javascript">
- $(function(){
- $("#country").change(function() {
- var country = $(this).val()
- var currency = {
- USD: "USD",
- EUR: "EUR",
- GBP: "GBP"
- }[country]
-
- if (currency)
- $("[name=optradio][value='" + currency + "']").prop("checked", true)
- })
- });
- </script>
here is the html (I did not include the text boxes)
- <div class="col-md-3 form-inline">
- <div class="form-group">
- <label for="Country">Region</label>
- <select name="Country" class="form-control" id="country" required>
- <option value="">Please select Region</option>
- <option value="USA">US</option>
- <option value="EUR">EU</option>
- <option value="GBP">UK</option>
- <option value="USD">China</option>
- <option value="USD">India</option>
- <option value="USD">Brazil</option>
- <option value="USD">Japan</option>
- </select>
- </div>
- </div>
-
- <div class="col-md-3 form-inline">
-
- <div class="form-group">
- <label for="Currency">Currency</label>
- <label class="radio-inline">
- <input type="radio" name="optradio" value="USD" disabled="">USD</label>
- <label class="radio-inline">
- <input type="radio" name="optradio" value="EUR" disabled="">EUR</label>
- <label class="radio-inline">
- <input type="radio" name="optradio" value="GBP" disabled="">GBP</label>
- </div>
- </div>
here is the price list
Car
US
UK
EU
China
India
Brazil
Japan
BMW
5000
4000
4400
8000
9000
7000
4000
Ford
4000
3500
4000
9000
11000
10000
6000
can anyone please help me, how can I get the data from the database for the text field for different region.
thank you