Ciao a tutti,
per prima cosa auguri di buon anno.
Ho navigato per giorni cercando di trovare una risposta ma niente.
Spero che scrivendo sul "non prusulta dei siti"
riesca atrovare la soluzione.
dunque questo è il mio script
codice:
global $user, $cookie, $sitename, $admin_file, $admin, $prefix, $db, $module_name, $currentlang, $NameOfTheme, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4;
?>
<script type="text/javascript">
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Jay Rumsey | http://www.nova.edu/~rumsey/ */
function UpdateCost() {
var sum = 0;
var gn, elem;
for (i=0; i<5; i++) {
gn = 'amount_q'+i;
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
}
document.getElementById('totalcost').value = sum.toFixed(2);
}
</script>
<table align="center" border="0" cellSpacing="2" cellPadding="0" width="100%">
<tr height="30">
<td class="content" colspan="5"><?php echo ''._LN_SERVICE.''; ?></td>
</tr>
<tr align="center" height="30">
<td class="bgbar" width="5%"><?php echo ''._LN_N.''; ?></td>
<td class="bgbar" width="40%"><?php echo ''._LN_DESCRIPTION.''; ?></td>
<td class="bgbar" width="10%"><?php echo ''._LN_TOTUNIT.''; ?></td>
<td class="bgbar" width="35%"><?php echo ''._LN_TOTQUOTE.''; ?></td>
<td class="bgbar" width="10%"><?php echo ''._LN_TOTALL.''; ?></td>
</tr>
<form method="post" action="<?php echo 'modules.php?name=Liste_Nozze&op=view_nozze&id_ln='.$id_ln.'&user_id='.$user_id.''; ?>">
<?php
while ($row2 = $db->sql_fetchrow($result2))
{
$id_s = $row2['id_s'];
$idln_s = $row2['idln_s'];
$description_s = $row2['description_s'];
$date_s = $row2['date_s'];
$amount_s = $row2['amount_s'];
$minamount_s = $row2['minamount_s'];
if ($id_s == "") {$id_s="";}
if ($description_s == "") {$description_s="";}
if ($date == "") {$date='';}
if ($amount_s == "") {$amount_s='';}
$amount_q = 0;
$amount_q = $amount_s / $minamount_s;
?>
<tr height="20">
<td align="center" class="linebot"><span class="tiny"><?php echo ''.$id_s.''; ?></span></td>
<td class="linebot"><span class="tiny"><?php echo ''.$description_s.''; ?></span></td>
<td align="center" class="linebot"><span class="tiny"><?php echo ''.$amount_q.''; ?></span></td>
<td class="linebot"><?php for ( $i=0; $i < $minamount_s; $i++ ) { ?><input class="styled" type="checkbox" id="amount_q[]" value="<?php echo ''.$amount_q.''; ?>" onclick="UpdateCost()" /><?php } ?></td>
<td align="center" class="linebot"><span class="tiny"><?php echo ''.$amount_s.''; ?></span></td>
</tr>
<?php
}
?>
<tr height="30">
<td align="right" colspan="4">Costo totale: </td>
<td align="center"><input class="inputbox" type="text" id="totalcost" value="0" size="5" /></td>
</tr>
<tr height="30">
<td colspan="3">
<!-- <input type="hidden" name="op" value="quote_edit" />
<input type="hidden" name="user_id" value="<?php echo ''.$user_id.''; ?>" />
<input type="hidden" name="id_ln" value="<?php echo ''.$id_ln.''; ?>" /> -->
</td>
<td colspan="2"><input class="button" type="submit" name="submit" value="<?php echo ''._LN_SAVE.''; ?>" /></td>
</tr>
</form>
<?php
quello che vorrei fare è selezionando delle quote tramite i checkbox avere il totale in tempo reale per poi tramite la submit portarlo in altro file e di conseguenza db
Spero di essermi spiegato bene e di avere fortuna nelle risposte
Ciao