2 Replies - 3670 Views - Last Post: 09 April 2009 - 06:36 AM Rate Topic: -----

#1 suxinjava  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 10-August 08

widget cost calculator

Posted 09 April 2009 - 05:44 AM

1.Create a widget cost calculator(widget.php).This application is able to calculate the widget(s) purchased by the price and tax entered by user.

i still got the erroe.can someone help me to fix it?!kindly appreciate it. ;[


here are the coding:

<?php
$page_title = "Widget Cost Calculator";
include('header.html');

if(isset($_POSTS['submitted'])) {
if(is_numeric($_POST['quantity']) && is_numeric($_POST['price']) && is_numeric($_POST['tax'])) {

// Calculate the Cost
$taxrate = $_POST['tax'] / 100;
$total = ($_POST['quantity'] * $_POST['price']) * ($taxrate + 1);

// Display the Cost
echo '<h1 id="mainhead">Total Cost</h1>
<p>The total cost of purchasing '.$_POST['quantity'].' widget(s) at $'.number_format($_POST['price'],2).' each, including a tax rate of '.$_POST['tax'].'%, is $'.number_format($total, 2).'.</p><p><br /></p>';

} else {
echo '<h1 id="mainhead">Error!</h1>
<p class="error">Please enter a valid quantity, price, and tax.</p><p><br /></p>';
}
}
?>
<h2>Widget Cost Calculator</h2>
<form action="widget.php" method="post">
<p>Quantity: <input type="text" name="quantitiy" size="5" maxlength="10" /></p>
<p>Price: <input type="text" name="price" size="5" maxlength="10" /></p>
<p>Tax (%): <input type="text" name="tax" size="5" maxlength="10" />
<p><input type="submit" value="Calculate!" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>
<?php
include('footer.html');
?>


This post has been edited by suxinjava: 09 April 2009 - 05:48 AM


Is This A Good Question/Topic? 0
  • +

Replies To: widget cost calculator

#2 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: widget cost calculator

Posted 09 April 2009 - 06:17 AM

View Postsuxinjava, on 9 Apr, 2009 - 12:44 PM, said:

1.Create a widget cost calculator(widget.php).This application is able to calculate the widget(s) purchased by the price and tax entered by user.

i still got the erroe.can someone help me to fix it?!kindly appreciate it. ;[


here are the coding:

<?php
$page_title = "Widget Cost Calculator";
include('header.html');

if(isset($_POSTS['submitted'])) {
if(is_numeric($_POST['quantity']) && is_numeric($_POST['price']) && is_numeric($_POST['tax'])) {

// Calculate the Cost
$taxrate = $_POST['tax'] / 100;
$total = ($_POST['quantity'] * $_POST['price']) * ($taxrate + 1);

// Display the Cost
echo '<h1 id="mainhead">Total Cost</h1>
<p>The total cost of purchasing '.$_POST['quantity'].' widget(s) at $'.number_format($_POST['price'],2).' each, including a tax rate of '.$_POST['tax'].'%, is $'.number_format($total, 2).'.</p><p><br /></p>';

} else {
echo '<h1 id="mainhead">Error!</h1>
<p class="error">Please enter a valid quantity, price, and tax.</p><p><br /></p>';
}
}
?>
<h2>Widget Cost Calculator</h2>
<form action="widget.php" method="post">
<p>Quantity: <input type="text" name="quantitiy" size="5" maxlength="10" /></p>
<p>Price: <input type="text" name="price" size="5" maxlength="10" /></p>
<p>Tax (%): <input type="text" name="tax" size="5" maxlength="10" />
<p><input type="submit" value="Calculate!" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>
<?php
include('footer.html');
?>




what error are you receiving ???
Was This Post Helpful? 0
  • +
  • -

#3 suxinjava  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 10-August 08

Re: widget cost calculator

Posted 09 April 2009 - 06:36 AM

maybe i got the problm at my database system/or prob with my macromedia
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1