This is a discussion on "[SOLVED] Calc function" within the JavaScript Forum section. This forum, and the thread "[SOLVED] Calc function are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Calc function
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] Calc function
Hi please check my wepage www.ernis.no , click on a picture>scroll down>konfigurer>click on a picture>select a radio button. On the bottom right side is a calculator:
|
|
|
|
#2
|
||||
|
||||
|
Re: Calc function
Okay so you want to do something like this -- assuming that you are echoing everything to the page with PHP
Hope that helps,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#3
|
|||
|
|||
|
Re: Calc function
Quote:
|
|
#4
|
||||
|
||||
|
Re: Calc function
It doesn't make sense to me
this line var totalPrice = ', $totalPrice, ' if this is in PHP it is wrong and it it is not in PHP it is still wrong in javascript.... In the code I gave you, you have to use echo ' var totalPrice = ', $totalPrice, ';'; if you are using PHP or var totalPrice = '<?php echo $totalPrice;?> '; if you are coming in and out of PHP. The whole code for the javascript function should be
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#5
|
|||
|
|||
|
Re: Calc function
Quote:
Last edited by Pugger; Nov 5th, 2007 at 08:20. |
|
#6
|
||||
|
||||
|
Re: Calc function
Every radio button needs to have the same name if you want only one to remain selected..
There was also a typo in the Javascript code.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#7
|
|||
|
|||
|
Re: Calc function
Quote:
Last edited by Pugger; Nov 5th, 2007 at 10:03. |
|
#8
|
||||
|
||||
|
Re: Calc function
Try this
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#9
|
|||
|
|||
|
Re: Calc function
Same error, no change..Is there any other way to pass the value to php? I tried to google and found out that either i need to pass the js var in a js cookie or refresh the page.
Last edited by Pugger; Nov 5th, 2007 at 10:48. |
|
#10
|
||||
|
||||
|
Re: Calc function
What does $totalpris actually contain? There are no errors in that code unless totalprice has an messy value.. Is it just a straight up integer?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#11
|
|||
|
|||
|
Re: Calc function
Quote:
|