[Solved] PHP & JAVASCRIPT – How to take values from multiple input fields after clicking on the buttons which are connected to each input field? [closed]


You could do something through jQuery:

$('.edit_profile').on('click', function(){
   // if still disabled, return;
   if ($(this).prev().is(':disabled')) return;
   // otherwise we go for value:
   var value = $(this).prev().val();
   console.log(value);
});

And please take a look for function: prev() https://api.jquery.com/prev/

For passing your fields to php use ajax:

$.ajax({
    type: "POST",
    url: "myphpscriptforupdate.php",
    dataType: 'html',
    data: { 
        p_year: $('#p_year').val() 
    },
    success: function(data){
        // data = response from php (the things you echoed)
        }
});

5

solved PHP & JAVASCRIPT – How to take values from multiple input fields after clicking on the buttons which are connected to each input field? [closed]