homepage Welcome to WebmasterWorld Guest from 54.226.188.142
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
textfield1+textfield2
skoff




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

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.

 

Anyango




msg:4240911
 10:09 am on Dec 10, 2010 (gmt 0)

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

<input type="text" name="textfield3" id="textfield3" value="<?php =$result;?>">

Matthew1980




msg:4241117
 5:41 pm on Dec 10, 2010 (gmt 0)

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

Anyango




msg:4241530
 12:25 pm on Dec 12, 2010 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved