Welcome to WebmasterWorld Guest from 54.161.255.61

Forum Moderators: coopster & jatar k

textfield1+textfield2

   
8:49 pm on Dec 9, 2010 (gmt 0)

5+ Year Member



is there a way to make an addition with two text field with the values that they have in them.
Example if my textfield1 contain 1 and the textfield2 contain 3 i would like to have the result 4 in a textfield3.
10:09 am on Dec 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?php
$result=floatval($_REQUEST["textfield1"])+floatval($_REQUEST["textfield2"]);
?>

<input type="text" name="textfield3" id="textfield3" value="<?php =$result;?>">
5:41 pm on Dec 10, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi all,

Unless I misunderstand the context of this, I would urge you to substitute the _REQUEST for _POST, this is purely for a more secure approach, but if this is just for development, you should be fine, but honestly try not to use _REQUEST on a live server as you will reveal lots of information about your site.

Cheers,
MRb
12:25 pm on Dec 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep makes sense, just that i didnt know what his form submission method was and i didnt want to post something that won't work for him when he tries
 

Featured Threads

Hot Threads This Week

Hot Threads This Month