By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,746 Members | 1,735 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,746 IT Pros & Developers. It's quick & easy.

Compute and display data on the same page

P: 1
well,
when user inputs the data, i should be able to fetch the data from the database and do some numerical computaions and display the result on the same page before i submit the data to the php script,

the php script takes all the posted data and dump it into the database,


how to achieve this

me using
PHP 5.0/MySQL 4.0
Jan 27 '07 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
What code do you have so far?

This should be posted in the PHP forum, but don't double post. A moderator will probably move it soon.
Jan 27 '07 #2

Ganon11
Expert 2.5K+
P: 3,652
Indeed, we will. Moving this thread...
Jan 27 '07 #3

Expert Mod 100+
P: 2,328
Look into the use of Javascript to process data on the client side, or if you really want to get creative, AJAX.
Jan 27 '07 #4

ronverdonk
Expert 2.5K+
P: 4,258
Looks indeed like the perfect problem to tackle with an Ajax solution. That way you can, after the user has inputted some field(s), go to the server database, get the data and display it on the screen. All without screen refreshes.

But, as acoder put to you in an earlier post: "What code do you have so far?". Show it and we will see where we can assist you.

Ronald :cool:
Jan 28 '07 #5

P: 51
Hi
you can use the following code for a running total. customize it according to ur requirements.

[HTML]
<html>
<head>
<script>
function getTotalBurn()
{
f = document.form1;
superficial = parseFloat(f.a.value) + parseFloat(f.b.value)
f.c.value = superficial.toFixed(2)
}
</script>
</head>
<body>

<form id="form1" name="form1" method="post" action="" onkeyup="getTotalBurn()">
<p>
1st Number
<input type="text" name="a" size="10" />
</p>
<p>
2nd Number
<input type="text" name="b" size="10" />
</p>
<p>
Total
<input type="text" name="c" value="0" size="10" />
</p>
</form>
</body>
</html>
[/HTML]
Jan 29 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.