0
I would like to click, for example in the option "10 People"...
It changed the label of several other selects, for example, this: "Special Fillings: R$10". I would like, for example, it to become "Special Fillings: R$20". When I choose "30 People", I switch to "Special Fillings: R$40".
Here’s a part of my code: (I’m using the Select2 plugin, but I don’t know if it’s relevant to this issue)
I believe it is a solution VERY SIMILAR to this, but that instead of changing the content of <div>
, change the one from <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>
Works like a Charm :) THANK YOU!
– Murilo Ravani