Could you please help me with this situation?
Let's say I have this right now:
HTML
<select name="insta_country_code" class="widget-user-country country-selector" data-account-name="
<?php echo $account1['Username'] ?>">
<option value="br">Brazil</option>
<option value="cl">Chile</option>
<option value="es" selected>Spain</option>
<option value="mx">Mexico</option>
<option value="gb">United Kingdom</option>
<option value="cr">Costa Rica</option>
</select>
JS
$(document).ready(function () {
$('.country-selector').change(function () {
var ig_name = $(this).data('account-name');
var country_code = $(this).val();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'change-country.php',
data: {
insta_user: ig_name,
country_code: country_code,
},
success: function (data) {
if (data['status'] != 1) {
$.alert('server error');
}
},
error: function () {
$.alert('error');
}
});
})
});
What should be my .php
file? I need to do something like this:
$InstagramCountry = $data['country_code'];
$InstagramUsername = $data['insta_user']);
$sql = mysql_query("UPDATE igaccounts SET Country='$InstagramCountry' WHERE Username='$InstagramUsername'");
Thank you so much!