I want to call a function in php onchange
in select
of html,how can this be done?
html code
<div class="col-sm-4 form-group">
<label for="c_city">City</label>
<select class="form-control" id="c_city" onchange="<?php getArea(); ?>">
<option value="">Select City Name</option>
<!--populate value using php-->
<?php
$stmt ="SELECT * FROM Cities";
foreach ($con->query($stmt) as $row) {
?>
<option value="<?php echo $row['City_ID'];?>"><?php echo $row['City_Name'];?></option>
<?php
}
?>
</select>
</div>
PHP Functions Page
function getArea()
{
if(isset($_GET['c_city']))
{
$c_city = $_GET['c_city'];
echo $c_city;
}
}