I would like, by clicking, for example in the "10 People" option ...
Hechangedthelabelofseveralotherselects,forexample,thisone:"Special Fillings: R $ 10". I would like it, for example, to become "Special Fillings: $ 20". When I chose "30 People", change to "Special Feeds: $ 40."
Here's a part of my code: (I'm using the select2 plugin, but I do not know if it's relevant to this question)
I think it's a VERY SIMILAR solution to this one, but instead of changing the content of <div>
, change that to <optgroup label="">
: Link to similar solution
<form class="form" method='post' id='formBoloMesa' action="custom_includes/orderBolo.php">
<div class="form-group">
<span class="resume-subtitle">Escolha o tamanho</span>
<select name="tamanho" class="form-control select2-list select-options-1" data-placeholder="Clique aqui para escolher" multiple>
<optgroup label="Tamanho">
<?php
include ('custom_includes/connect.php');
$strTamanho = "SELECT * FROM bolo_mesa_itens WHERE tipo='tamanho'";
$rsTamanho = mysql_query($strTamanho);
while($rowTamanho = mysql_fetch_array($rsTamanho)) {
echo '<option value="' . $rowTamanho['nome'] . '">' . $rowTamanho['nome'] . '</option>';
}
?>
</optgroup>
</select>
</div>
<div class="form-group">
<span class="resume-subtitle">
Escolha o modelo
</span>
<select name="modelo" class="form-control select2-list select-options-1" data-placeholder="Clique aqui para escolher" multiple>
<optgroup label="Tipo de Bolo">
<?php
$strModelo = "SELECT * FROM bolo_mesa_itens WHERE tipo='modelo'";
$rsModelo = mysql_query($strModelo);
while($rowModelo = mysql_fetch_array($rsModelo)) {
echo '<option value="' . $rowModelo['nome'] . '">' . $rowModelo['nome'] . '</option>';
}
?>
</select>
</div>
<div class="form-group">
<span class="resume-subtitle">Escolha a Massa</span>
<select name="massa" class="form-control select2-list select-options-1" data-placeholder="Clique aqui para escolher" multiple>
<optgroup label="Massas">
<?php
$strMassas = "SELECT * FROM bolo_mesa_itens WHERE tipo='massa'";
$rsMassas = mysql_query($strMassas);
while($rowMassas = mysql_fetch_array($rsMassas)) {
echo '<option value="' . $rowMassas['nome'] . '">' . $rowMassas['nome'] . '</option>';
}
?>
</optgroup>
</select>
</div>
<div class="form-group">
<span class="resume-subtitle">Escolha 3 recheios</span>
<select name="recheio1" class="form-control select2-list select-options-1" data-placeholder="Escolha o 1º Recheio" multiple>
<optgroup label="Recheios Comuns">
<?php
$strRecheios = "SELECT * FROM bolo_mesa_itens WHERE tipo='recheio'";
$rsRecheios = mysql_query($strRecheios);
while($rowRecheios = mysql_fetch_array($rsRecheios)) {
echo '<option value="' . $rowRecheios['nome'] . '">' . $rowRecheios['nome'] . '</option>';
}
?>
</optgroup>
<optgroup label="Recheios Especiais (+R$10)">
<?php
$strRecheiosPremium = "SELECT * FROM bolo_mesa_itens WHERE tipo='recheio' AND premium='1'";
$rsRecheiosPremium = mysql_query($strRecheiosPremium);
while($rowRecheiosPremium = mysql_fetch_array($rsRecheiosPremium)) {
echo '<option value="' . $rowRecheiosPremium['nome'] . '">' . $rowRecheiosPremium['nome'] . '</option>';
}
?>
</optgroup>
</select>