Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.javascript,comp.lang.php Subject: Re: Form processing issue Date: Fri, 15 Jan 2021 22:10:03 +0100 Lines: 29 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net hzTjbZEYEP6W3TQpWuLjDwwqBuxLxNGjHc0H9KRMcU2C4mhAys Cancel-Lock: sha1:Faq1WqegiwMyw+ueT0/hSmqXr3o= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 In-Reply-To: Content-Language: en-US-large Xref: csiph.com comp.lang.javascript:39364 comp.lang.php:18521 On 15/01/2021 18.57, The Doctor wrote: > Got this form doing > a calculation as follows: > put the fraction in this case is > coming out as 52.5.00 when it is suppose to pass > 52.50 ? Remove the '+ ".00"', you need to use number_format() in php to get the right number of decimals, see https://www.php.net/manual/en/function.number-format.php > Given the above , how do I fix this? I would suggest a clean rewrite of the whole thing, I would suggest node.js, angular, or something similar, just see to make ajax calls to fetch the raw data in json format from the backend (php or database). Do not generate dynamic javascript in php, you will just end up with a code that is difficult to maintain and of course your teacher will fail you. -- //Aho