Welcome visitor
* Login
* Register
It is currently September 20th, 2019, 9:34 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 3 posts ] 
Author Message
  add form values
PostPosted: June 11th, 2009, 7:28 am 
User avatar

Posts: 42
how can i add two values of a form and then show the result?

something for this
<input name="yours">
<input name="theirs">
<input type="button" value="add">
<input name="total">


thanks.


Top
 Profile  
 
  Re: add form values
PostPosted: June 11th, 2009, 8:00 am 
User avatar

Posts: 81
yours is not technically a form, is just input fields and a button. so try this
<input id="yours" />
<input id="theirs" />
<input type="button" value="add"
onclick="a=document.getElementById('yours').value*5/5;
b=document.getElementById('theirs').value*5/5;
c=a+b;
document.getElementById('total').value=c;" />
<input id="total" />


and this is the PHP code to add a form on the server
$total=$_POST['yours']+$_POST['theirs']
echo '<input value="' . $total . '" />';


Top
 Profile  
 
  Re: add form values
PostPosted: June 11th, 2009, 8:11 am 
User avatar

Posts: 42
ok, thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron