I have this program that puts selected
according to value
:
<!--inicio if option = selected-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><script>$(document).ready(function(){//frasequedesejolocalizar(pegaovaluedooption)varfrase="minAlarme4_analogico00",
localizado = null;
// loop que percorre cada uma das opções
// e verifica se a frase da opção confere com o
// valor de fase que está sendo procurado
// valor de fase que está sendo procurado
$('#Linha5 option').each(function() {
// se localizar a frase, define o atributo selected
if($(this).attr('value') == frase) {
$(this).prop('selected', true);
}
});
});
</script>
<!--Final if option = selected-->
But to generate these "values" I have a program that does this. Note: Unfortunately I can not post this source code and I do not actually have access to it.
But I have the following content in the "values" of the code I have access to. The "value" is thus value=\"%s\"%s>%s
. Example:
printf("<option value=\"%s\"%s>%s</option>\n", $nomeScript, $extra, $descricaoScript);.
How to create an array in PHP that communicates with JavaScript?
(Previously I posted a question saying that I needed it otherwise, but as the data comes from the database I think I need the array to be in PHP to pass the values to JavaScript.)