![]() |
php coding problem.!!..
i want to add two number,and then i want complier to ask me,if i want to add more number in previously added number,if i say yes it should add two more number to previous number and if i say no it should show the current result,for ex:if i want to add 5 and 8 it would be 13,then i want compiler to ask if i want to add more number,if no then it should show 13,if yes then it would add another two numbers in 13.
Here is the code i have tried PHP Code:
|
You can't do that with PHP in a web environment. HTTP is stateless and PHP is a server side language, so it only works on request and response. You can use AJAX for that, but if you're doing that anyways you may as well put the burden entirely on the JS for the calculations.
What you can do is keep track of the sum and pass it through a hidden field on the form. Then you can keep self submitting the form and so long as the sum is > 0, you simply provide only one field to add to it, otherwise you give two fields to add together. |
you can try something like this:
PHP Code:
|
| All times are GMT +1. The time now is 01:12 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.