Answers for "php onchange"

2

onchange on select tag

<select id="comboA" onchange="getComboA(this)">
  <option value="">Select combo</option>
  <option value="Value1">Text1</option>
  <option value="Value2">Text2</option>
  <option value="Value3">Text3</option>
</select>
Posted by: Guest on May-19-2020
5

js select on change value

document.getElementById('my-select').addEventListener('change', function() {
  console.log('You selected: ', this.value);
});
Posted by: Guest on May-14-2020
0

php input onchange

/*
You can't execute PHP in the browser.
Do an AJAX call or POST to a PHP function on the web server, 
or write a Javascript function that executes in the browser.
*/

// html
<input name="file" onchange="mainInfo(this.value);"
// AJAX
function mainInfo(id) {
    $.ajax({
        type: "GET",
        url: "mypage.php",
        data: "mainid =" + id,
        success: function(result) {
            $("#somewhere").html(result);
        }
    });
};

// php
<?php
    if(isset($_GET['mainid'])){
        mainInfo($_GET['mainid']);
    }
?>
Posted by: Guest on May-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language