WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : My Box - PHP Class that calculates the volumetric weight of a package.
Categories : PHP, Object Oriented, PHP Classes, Beginner Guides, Payment Gateways
ROBERTO ALEMAN
Date : Oct 24th 2010
Grade : Be the 1st to grade this Code Example
Viewed : 6310
File : 5060.rar
Images : No Images for this code example.
Search : More code by ROBERTO ALEMAN
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

This is a very simple class that can calculate volumetric weight of a package.

It takes the dimension of a package defined by its width, height and depth, and computes the volumetric weight.

The class displays the volumetric weight of the package expressed either in Kg or pounds.

mybox.php
<?php
class mybox{ //declare class
function calc_mybox($heigth,$legth,$width) // declare function and send parameter,
   
{
   
$calc = ($heigth*$legth*$width)/6000; // calculation
   
$total = number_format($calc, 2, '.', ''); // number format
   
$poun = number_format($total*2.20462262, 2, '.', ''); // conver to pounds
   
echo "<br/><center><div style='width:400px; height:600px;'><strong>Calculating Volumetric Weight 
          in Kg and Pounds</strong><br /><br />
<div style='width:250px; text-align:center; float:left; '><img src='box.png'  width='250'height='220'/></div>
<div style='width:100px; float:left; padding:5px; height:30px;'> Results: <strong>"
.$total." Kg</strong> or <strong>".$poun." Pounds</strong></div>
<div style='width:100px; float:left; padding:5px; height:110px;margin-left:-10px;'><br/><br/> Height : <strong>"
.$heigth." Cm</strong></div>
<div style='width:100px;float:left;  padding:5px; height:15px;'></div>
<div style='width:100px;float:left;  padding:5px; height:30px; margin-left:-30px;'> Length : <strong>"
.$legth." Cm</strong></div>
<div style='width:350px; float:left;  padding:5px;clear:both; margin-top:-30px;margin-left:-10px;'> Width : <strong>"
.$width." Cm</strong></div>
<div style='width:370px; float:left; height:180px;  padding:5px;clear:both;'><strong>Calculating Volumetric Weight in Kg and Pounds</strong><br /><br /></center>"
; // show results
   
return;
    }
}
?>


index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Class My Box</title>
</head>
<body style="color:#000000; font-family:Arial; font-size:12px;">
<center>
<h1>MyBox</h1>
<h2>Calculate volumetric weight of a package</h2>
<form action="index.php" method="post" target="_self">
          <label>Heigth : <input name="heigth" type="text" id="heigth" size="10" maxlength="10" /> (in centimeters)<br /><br /></label>
          <label>Length : <input name="length" type="text" id="length" size="10" maxlength="10" /> (in centimeters)<br /><br /></label>
          <label>Width : <input name="width" type="text" id="width" size="10" maxlength="10" /> (in centimeters)<br /><br /></label>
          <input name="submit" type="submit" id="submit" />
          <input name="input" type="reset" value="Reset" />
</form></center></div>
</div>
<?php
require_once("mybox.php");
if(isset(
$_POST['submit']))
    {
       
$newbox= new mybox();
       
$newbox->calc_mybox($_POST[heigth],$_POST[length],$_POST[width]);
    }

?>
</body>
</html>



News management class
Categories : PHP, PHP Classes, Beginner Guides
Authorize.net AIM Interface Class v1.0.0
Categories : PHP, PHP Classes, Ecommerce, Payment Gateways
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
PHP Paypal IPN Integration Class v1.0.0
Categories : PHP, PHP Classes, Payment Gateways
PHP Image Validation Class - test if a specific file is of a certain image type without relying on the said file extension.
Categories : PHP, PHP Classes, Data Validation, Graphics, Beginner Guides
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides
SPL and ITERATOR : examples
Categories : PHP, Object Oriented, PHP Classes, Sessions
Advanced Image WaterMarker
Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented
SQLite PHP Database Wrapper
Categories : PHP, PHP Classes, Databases, SQLite, Beginner Guides
PHP Class to calculate Degrees Minutes Seconds to Decimal Degrees
Categories : PHP, PHP Classes, Geo Related, Beginner Guides
Football News Aggregator
Categories : PHP, Object Oriented, PHP Classes, Rich Site Summary (RSS), HTML and PHP
Access_user Class - an easy to use system for protecting pages and register users.
Categories : PHP, Classes and Objects, Object Oriented, PHP Classes, Authentication
A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
An updated OOP - Inheritance
Categories : PHP, PHP Classes, Object Oriented
EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly.
Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library