Re: form

From: Date: Sun, 01 Apr 2001 07:28:57 +0000
Subject: Re: form
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-46497@lists.php.net to get a copy of this message
On 31 Mar 2001 22:03:54 -0800, Sean Weissensee <phpinfo@weissystems.com> wrote: >I have a shopping cart system I wrote which display several detail lines >of items purchased, at the moment if the user changes a quantity they have >to manualy >click a link to recalulate the total, I would like this to happen as soon as >the >user tabs of the qty field. Use an OnBlur() handler and some JavaScript. However, you'll still need to do the calculations on the server to prevent cheating because if you want to support older browsers, you'll need to put the total in an <INPUT TYPE="TEXT" field. Your PHP code could generate a JavaScript function ("recalc()") that would check each item and a cost * quantity to update the subtotal; when they hit submit, you'd need to do the same check in PHP to be sure of getting an accurate result.

« previous php.general (#46497) next »