I have a little problem with this code included beneath. This is function of library called Sweet Alert 2. I'd like to have "inputOptions" loaded from php
Code I have right now:
function pick(){
swal({
title: 'Choose country',
input: 'select',
inputOptions: {
'SRB': 'Serbia',
'UKR': 'Ukraine',
'HRV': 'Croatia'
},
inputClass: 'form-control select',
confirmButtonColor: '#78339b',
inputPlaceholder: 'choose country',
showCancelButton: true,
}).then(function(result) {
swal({
type: 'success',
html: 'You selected: ' + result
})
});
}
I'd like to have part with input Options like this:
<?php
$ct = mysql_query("SELECT * FROM db WHERE typ = 1",$link);
while($row = mysql_fetch_array($ct)){
echo $row['id'] : $row['country'];
}
?>
I know this won't work but you know what I mean. Can someone actually help me? I would genuinely appreciate any tips on how to do this