473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

A Calculator Bug

i just created this benefits calculator, but it doesn't work, there is
no changes happen after submitting, anyone can help in that??
<html>
<head>
<title> |||Stocks Calculator||| </title>
<style type="text/css">
<!--
body {font-size: 14pt}
..heading {font-size: 18pt; color: red}
-->
</style>
</head>
<?php
if (!isset($_post['submit']) || $_post['submit'] != 'Calculate')
{
$_post['price'] = "";
$_post['sell'] = "";
$_post['pricec'] = "";
$_post['sellc'] = "";
$gain = (($_post['sell'] - $_post['sell'] * $_post['sellc']) -
($_post['price'] + $_post['price'] * $_post['pricec']));
} else {
print("Still Shit Happens");
}
?>
<body>
<div align="center" id="div1" class="heading">
<b><i><u>Stocks Calculator</u></i></b></div>
<p class=blurb>Enter all the data required to get your gain calculated
by our gain calculator for stocks<br>
*Please notice: Approximatly value for commisions in the Egyptian stock
exchange is 0.005% - 0.006%.</p>

<form action="<?php echo $_server['php_self']; ?>" method="post">
<p>Buy Price:
<input type="text" size="10" name="price" value="<?php echo
$_post['price']; ?>">
<p>Commision:
<input type="text" size="5" name="pricec" value="<?php echo
$_post['pricec']; ?>">
<p>The Price you want to sell at:
<input type"text" size="10" name="sell" value="<?php echo
$_post['sell']; ?>">
<p>Commision:
<input type="text" size="5" name="sellc" value="<?php echo
$_post['sellc']; ?>">
<BR><BR>
<P><B>Net Gain :</B> <?php echo $gain; ?>
<p><input type ="submit" name="submit" value="Calculate">
</form>
</body>
</html>

Dec 30 '05 #1
2 1440
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

XIII wrote:
i just created this benefits calculator, but it doesn't work, there is
no changes happen after submitting, anyone can help in that?? [...] <?php
if (!isset($_post['submit']) || $_post['submit'] != 'Calculate')


You have forgotten about PHP being case-sensitive. $_post is not the same as
$_POST.

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

La documentación es el aceite de ricino de programar.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDtIr53jcQ2mg3Pc8RAuKEAJ4xHp/xW1WmQUklKb1bdUlNhtcf1gCeLVwO
PQjoJJdyG2r34UNQhHWV4tA=
=Ey03
-----END PGP SIGNATURE-----
Dec 30 '05 #2
XIII wrote:
i just created this benefits calculator, but it doesn't work, there is
no changes happen after submitting, anyone can help in that??
<html>
<head>
<title> |||Stocks Calculator||| </title>
<style type="text/css">
<!--
body {font-size: 14pt}
.heading {font-size: 18pt; color: red}
-->
</style>
</head>
<?php
if (!isset($_post['submit']) || $_post['submit'] != 'Calculate')

<snip>

I stopped reading here.

add
error_reporting(E_ALL);
ini_set('display_errors', '1');

right before the if() line above, so that all errors, warnings and
notices are displayed in the browser.

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Dec 30 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mwh | last post by:
Hi. If you remember, I posted Expressons Help. Now I am making a calculator with javascript. I can't get this to work: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
6
by: Rafael | last post by:
Hi Everyone, I need some help with my calculator program. I need my program to do 2 arguments and a 3rd, but the 3rd with different operators. Any help would be great. Here is my code.... ...
3
by: Paul | last post by:
I want to make a simple calculator program but dont know where to get started. This is not GUI but a simple terminal program. It would get input like this Enter number: 5 + 10
3
by: Art | last post by:
Hi, In part of my application the user may need to do a simple arithmetic calculation in order to get the value to put in a text box. I was thinking that it would be good if I could display the...
3
by: PieMan2004 | last post by:
Hi, ive been looking for a solid java community to help me when im tearing out my hair :) Basically ive constructed a GUI that has to represent the same look and functions of the typical windows...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
19
by: TexasNewbie | last post by:
This was originally just a calculator without a decimal point. After I added the decimal, it now tells me invalid second number. //GUI Calculator Program import javax.swing.*; import...
5
Deathwing
by: Deathwing | last post by:
Hi everyone one I'm playing around with trying to make an expense calculator. I would like it so that the user can keep enter expenses until they have no more expenses. Then I would like for the...
3
by: itsmichelle | last post by:
This is a very primative code of a java swing calculator. I have assigned all the number buttons and the operator buttons and I can add, subtract, multiply, and divide two numbers together. However,...
3
by: mandy335 | last post by:
public class Calculator { private long input = 0; // current input private long result = 0; // last input/result private String lastOperator = ""; // keeps track of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.