Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //........truncated code ..............
- $gTotal = 0;
- while($menu=mysql_fetch_array($pesanan))
- {
- $tot=$menu[harga]*$menu[jumlah];
- echo "<tr>\n"
- ."<td>$menu[nama_menu]</td>\n"
- ."<td><div align='center'>$menu[jumlah]</td></div>\n"
- ."<td><div align='center'>$menu[harga]</td></div>\n"
- ."<td><div align='center'>$tot</td></div>";
- $gTotal = $gTotal + $tot;
- }
- echo "</tr></table>";
- ."Total Pembelian Anda : Rp. $gTotal<br />\n"
- ."Bayar : Rp. <input name='bayar' type='text' id='bayar' />\n"
- ."<input name='proses' type='submit' id='proses' value='Click' />\n"
- ."<input name='kembali' type='text' id='kembali'/>\n"
- ."<input name='gTotal' type='hidden' id='gTotal' value='$gTotal' />\n" // add this line
- ."</form>";
- ?>
- <script type="text/javascript">
- $('#proses').click(function(){
- var kembalian;
- {
- gTotal=parseFloat($('#gTotal').val().replace(/[^\d\.\-\ ]/g, ''));;
- bayar=parseFloat($('#bayar').val().replace(/[^\d\.\-\ ]/g, ''));;
- kembalian=gTotal-bayar;
- $('#kembali').val(kembalian);
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement