PHP & My Sql Help Needed

CUMHUR ÇETİNKAYA

Junior Member
Joined
Apr 22, 2020
Messages
141
Reaction score
24
Hello everyone,

First of all i am not good at PHP etc. I need help about an issue.

sqlkate.png


This is my database and;

Adsız.png

This is the page.

What i want to do; is when i choose category, on dropdown menu, prices will come automatically from db "odeme" to "Görev Ücreti" place.

I give İDs to categories, but i dont know how to get prices. R there anyone to help me free ? :)

Code:
<div class="row">
                      <div class="col-md-4">
                        <div class="form-group">
                          <label class="bmd-label-floating">Kategori</label>
                          <select class="form-control" name="kate" id="kate" required required style="background-color: #202940;">
                             <option value="">Seçiniz</option>
        <option value="10">Instagram</option>
        <option value="11">Google Maps</option>
        <option value="12">GMail</option>
        <option value="13">YouTube</option>                     
        <option value="14">Google Play</option>                     
        <option value="15">WEB</option>                     
        <option value="16">Facebook</option>                     
        <option value="17">Twitter</option>                     
                         </select>
                        </div>
                      </div>
 
If you won't find solution, I'll be able to take a look at it in about an hour, so you can hit me up that time
 
You will have to use JavaScript to update your front-end when the value changes, as PHP cannot do this.
Listen for a change on the dropdown, and fill the field with the corresponding value. I don't have time to write code for this, but I hope this helps.
 
You need to use jquery to automatically fetch the prices.
 
Could you send me samples or how to do i ?

When you're populating your dropdown, you should populate it like this from the server side:

HTML:
<option value="10" odeme="0.75">Instagram</option>

And then in your javascript, using Jquery, you should be able to do something like this:

JavaScript:
$('select').change(function() {
    $("#gorev-div").html( this.find("option:selected").attr("odeme") )
});
 
Back
Top