-2
Good afternoon, you guys!
I’m trying to change a price according to the selected minutagem, but I’m not even getting through the function. I noticed this after using a alert
right after the start of the function named as treta_minutos()
. What am I doing wrong?
Script function that changes if it is a given ID and minut:
< script >
function treta_minutos() {
var id_plano = "<? echo"
$id_plano " ?>";
var franq_voz = tb_mobile_venda.franquia.value;
if ((id_plano == "1") && (franq_voz == "100")) {
document.tb_mobile_venda.assinatura.value += "8,00";
document.getElementById("assinatura").readonly = "readonly";
}
if ((id_plano == "2") && (franq_voz == "100")) {
document.tb_mobile.assinatura.value += "15,00";
document.getElementById("assinatura").readonly = "readonly";
}
} < /script>
Excerpt from the PHP code that creates the minute list:
if ($id_plano != "20" && $id_plano != "21" && $id_plano != "2" && $id_plano != "1") {
echo"<input name=\"franquia\" type=\"text\" id=\"franquia\" size=\"15\" value = \"$franquia\" readonly=\"readonly\"/>Minutos</td>";
} else {
if ($num_linhas_complemento != 0) {
echo "<select name=\"franquia\" id=\"franquia\" size=\"1\">
<option value=\"$franquia\">$franquia</option>";
echo "</select> MINUTOS";
} else {
//IMPRIMIR ITENS DO COMBO
$sql_combo_1 = "SELECT
valor_combo
FROM
gpoi.tb_mobile_venda
WHERE
campo_flex = 'franquia'
and cod_plano = '" . $id_plano . "'
ORDER BY ordenacao ASC;";
}
$dados_select_1 = mysql_query($sql_combo_1) or die('Erro:' . mysql_error());
$linhas_select = mysql_num_rows($dados_select_1);
echo "<select name=\"franquia\" id=\"franquia\" size=\"1\" onchange=\"treta_oi_voz();\">
<option value=\"ND\">Selecione...</option>";
for ($i = 0; $i < $linhas_select; $i++) {
$item = mysql_result($dados_select_1, $i, 'valor_combo');
echo "<option value=\"$item\">$item</option>";
}
echo "</select>";
echo " MINUTOS <font color=\"#FF0000\">*</font>";
}
Thank you very much, Celso. I made the change you recommended. And the divergent names was by my carelessness when trying to simplify the functions to post here on the forum. However, I found that the error was due to my XAMP not being enabled for short tags. But I already solved the problem. Thanks again!
– Hilder