Tuttosoft.it Php Nuke Italian Community: Forums
TUTTOSOFT :: Leggi il Topic - Restituire valore selezionando una checkbox
Precedente :: Successivo
Autore
Messaggio
vecchio_joe Moderatore Registrato: Sep 21, 2008 Messaggi: 126 Località: Roma
Inviato: Ven Nov 20, 2009 10:53 am Oggetto: Restituire valore selezionando una checkbox
Ciao raga,
ho un nuovo quesito per voi...
ho una pagina con diverse opzioni, cliccabili con dei chekbox
sia la prima seria che la seconda provengono da due tabelle diverse
per capire meglio allego immagine pagina
inoltre quando selezione qualcosa questa aggiorna in automatico il totale
il mio problema e che qualsiasi selezione io faccia si sulla prima serie che la seconda il valore che mi restituisce è sempre lo stesso ovvero l'ultimo campo presente nelle due tabelle
di seguito il codice della pagina (metto una immagine perchè non mi posta il codice)
Codice: <form name="sommacart" action="modules.php?name=<?php echo ''.$module_name.''; ?>" method="post">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr align="center">
<td class="bgbar" colspan="2" height="30"><strong><?php echo ''._DESCRIPTION.''; ?></strong></td>
<td class="bgbar" colspan="2"><strong><?php echo ''._SH_EXTRAPAY.''; ?></strong></td>
</tr>
<?php
$result3 = $db->sql_query('SELECT * FROM '.$prefix.'_shop_shipoptions ORDER by sid');
while ($row3 = $db->sql_fetchrow($result3))
{
$id_s = $row3['sid'];
$stitle = $row3['stitle'];
$sdescription = $row3['sdescription'];
$amount_s = $row3['soption'];
$active = $row3['active'];
?>
<tr>
<td align="center" class="linebot"><input type="checkbox" value="<?php echo ''.$amount_s.''; ?>" name="ototal" onClick="somma2(this.value, this.checked);" /></td>
<td class="linebot"><span class="content"><?php echo '<strong>'.$stitle.'</strong>'; ?></span><input type="hidden" name="shipoption" value="<?php echo ''.$stitle.''; ?>" /><br /><span class="tiny"><?php echo ''.$sdescription.''; ?></span></td>
<td class="linebot" colspan="2" height="40"><span class="content"><?php echo ''.$amount_s.' '.$currency.''; ?></span></td>
</tr>
<?php
}
?>
<tr>
<td colspan="4" height="10"> </td>
</tr>
<tr>
<td colspan="4" height="30"><span class="content"><?php echo '<strong>'._SH_ORDERPAY.'</strong>'; ?></span></td>
</tr>
<tr align="center">
<td class="bgbar" colspan="2" height="30"><strong><?php echo ''._DESCRIPTION.''; ?></strong></td>
<td class="bgbar" colspan="2"><strong><?php echo ''._SH_EXTRAPAY.''; ?></strong></td>
</tr>
<?php
$result4 = $db->sql_query('SELECT * FROM '.$prefix.'_shop_tipopagamento ORDER by id_tp');
while ($row4 = $db->sql_fetchrow($result4))
{
$id_tp = $row4['id_tp'];
$title_tp = $row4['title_tp'];
$description_tp = $row4['description_tp'];
$amount_tp = $row4['option_tp'];
$active_tp = $row4['active'];
?>
<tr>
<td align="center" class="linebot"><input type="checkbox" value="<?php echo ''.$amount_tp.''; ?>" name="ototal" onClick="somma2(this.value, this.checked);" /></td>
<td class="linebot"><span class="content"><?php echo '<strong>'.$title_tp.'</strong>'; ?></span><input type="hidden" name="id_tp" value="<?php echo ''.$title_tp.''; ?>" /><br /><span class="tiny"><?php echo ''.$description_tp.''; ?></span></td>
<td class="linebot" colspan="2" height="40"><span class="content"><?php echo ''.$amount_tp.' '.$currency.''; ?></span></td>
</tr>
<?php
}
$b_total = $o_total + $subtotal;
?>
<tr>
<td colspan="4"><hr color="#CCCCCC" /></td>
</tr>
<tr>
<td align="right" bgcolor="#EEEEEE" class="linebot" colspan="2"><span class="content"><?php echo '<strong>'._TOTAL.' : </strong>'; ?></span></td>
<td class="bgbot" colspan="2" height="40"><input class="inputbox" type="text" name="o_total" value="<?php echo ''.$b_total.''; ?>" size="15" readonly="readonly" /> <span class="tiny"><?php echo ''.$currency.''; ?></span></td>
</tr>
<tr>
<td align="right" class="linebot" colspan="2"><span class="content"><strong><?php echo ''._COMMENT.' :'; ?></strong></span></td>
<td class="linebot" colspan="2" height="30"><textarea rows="5" name="o_comment" cols="25"></textarea></td>
</tr>
<tr>
<td colspan="4" height="20"> </td>
</tr>
<tr>
<td align="center" colspan="4" height="40">
---- input type="hidden" name="order_description" value="<?php echo ''.$order_description.''; ?>" />
----- input type="hidden" name="s_op" value="ordersubmit" />
<back><img src="modules/<?php echo ''.$module_name.''; ?>/images/back.jpg" border="0"></a>
------ input type="image" src="modules/<?php echo ''.$module_name.''; ?>/images/check_out.jpg" border="0" /></a></td>
</tr>
</table>
</form>
quindi per capirci, da questa pagina se seleziono spedizione sda e pagamento bonifico
mi restituisce come valore, spedizione ritiro a mano e pagameno paypal ovvero gli ultimi due campi delle proprie tabelle
Attendo vostri consigli
Grazie
Torna in cima
vecchio_joe Moderatore Registrato: Sep 21, 2008 Messaggi: 126 Località: Roma
Inviato: Dom Nov 22, 2009 11:38 pm Oggetto:
Nessun suggerimento
Torna in cima
vecchio_joe Moderatore Registrato: Sep 21, 2008 Messaggi: 126 Località: Roma
Inviato: Sab Nov 28, 2009 11:34 am Oggetto:
queen neanche tu mi dai qualche suggerimento
Torna in cima
Non puoi inserire nuovi Topic in questo forumNon puoi rispondere ai Topic in questo forumNon puoi modificare i tuoi messaggi in questo forumNon puoi cancellare i tuoi messaggi in questo forumNon puoi votare nei sondaggi in questo forum