Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP calculations vs Javascript

Status
Not open for further replies.

jray2003

Programmer
Joined
Aug 12, 2003
Messages
253
Location
US
I have some pages that do some pretty hardcore calculations and Javascript does a good job, but if I am using PHP, are there simular methods for doing the same and redisplaying the information on the page?

Or is it better to leave the PHP pages as is and use javascript?

Thank you

Jim
 
One benefit of leaving them as they are is that the clients machine is having to do the work as appose to ur machine having to do the work if u use php. I would say if u don’t need to keep the information private and its working fine then don’t try to fix what isn’t broke.

To err is human, to completely mess up takes a computer.
 
You are talking about two completely different languages.
PHP is executed server side which means that in order to display changes on the page a redisplay is necessary. There is no altering page content with PHP once the page has left the server.
You need to take the pro and cons into consideration. With JavaScript you rely on the browser of the visitor to do the caluculations. There are people that turn JavaScript off. Maybe you want to ignore them - but you still need to make sure that your PHP code will handle submissions where no calculations were made.
DHTML is nice but doesn't work everywhere. With the PHP solution you can be 100% sure that the calculations are made.
 
Good points from the both of you. I still have much to consider both sides to this age old question.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top