Jump to content
xisto Community
maddog39

Php Calculator Simple but cool.

Recommended Posts

Well,everybody,we may conside that many things can be solved by many different ways.What we may do is try to find the best neat path.BTW,PHP,JSP,ASP are server-side scripts,Javascript,vbscript are client-side scripts.

Share this post


Link to post
Share on other sites

Well guys since you asked anyway. I have made and posted a Javascript version thats I also believe is alot better. Its got tons more capabilities and stuff. I posted the code to. So just go to:

http://forums.xisto.com/topic/7499-js-calculator/

Share this post


Link to post
Share on other sites

Calculator in javascript

Php Calculator

 

I just checkout the calculator posted here by someonein in javascript ..

 

But the problem is that it is showng the opreator in the text field also.

 

So can any one send the code of calculator which dnt shw the operator in the text field and havn only the single text field

 

 

 

-question by tarundeep singh

Share this post


Link to post
Share on other sites

The front-end HTML code for my PHP | Calculator is the same as yours but my back-end PHP scripting code differs a little from yours. This is what it I have. What mazes me is that I am not able to successfully run the script, thus, ending up with the PHP parser annoying me with its tedious error scripts. Please, try and help me out if you can. Thank you! :-)

 

<?php
if (($_POST[Value-1] = "") || ($_POST[Value-2] = "") || ($_POST[Calc] =""))
{
	header("Location: caculator.html");
	exit;
}
if ($_POST[Calc] == "Add")
{
	$result = $_POST[Value-1] + $_POST[Value-2];
}
else if ($_POST[Calc] == "Subtract")
{
	$result = $_POST[Value-1] - $_POST[Value-2];
}
if ($_POST[Calc] == "Divide")
{
	$result = $_POST[Value-1] / $_POST[Value-2];
}
else if ($_POST[Calc] == "Multiply")
{
	$result = $_POST[Value-1] * $_POST[Value-2];
}
?>
<html>
<head>
<title>
PHP | Calculator
</title>
</head>
<body>
<div align="center">
<p>The result of the computation was 
<?php
echo ("$result");
?>
</p>
<a href="calculator.html">Back</a >
</div>
</body>
</html>

Share this post


Link to post
Share on other sites

Can anyone help me with the code for a simple php calculation that I can paste into my wordpress blog?It only has one numerical input field I should think it would take someone who knows how under 10 mins to create the code which I would just want to paste into the wordpress page...The customer types in a number (relating to years in this case)i.eOver ____ Yearsand then then hits CALCULATE.Answer ___________The no. of years must then be multiplied by ?1500 with an additional ?1500 being added on top. i.e 10 years = ?16,500Let me know if you feel you can help...

Share this post


Link to post
Share on other sites

hi, i am new with php. can you help me fix my script problems? its errors is 'undefined variable. how do i define variable? the script works best only with quality() but not others. please. thanks in advance.


<?PHP$result=$_POST['day'];$pv=$_POST['pv'];$av=$_POST['av'];$rr=$_POST['rr'];$no=$_POST['no'];$tt=$_POST['tt'];$downtime=$_POST['downtime']; 	 if(!$_POST['day']) 	 { 	  echo '	 <form method="post" action="'.$_SERVER['PHP_SELF'].'">	   	  	  <select name="day"> 	   <option value="mon">Monday</option> 	   <option value="tue">Tuesday</option> 	   <option value="wed">Wednesday</option> 	   <option value="thu">Thursday</option> 	   <option value="fri">Friday</option>	   <option value="sat">Saturday</option>	   <option value="sun">Sunday</option> 	  </select><br />	  <td>Planned Volume:</td>	  <input type="text" name="pv" size="5"><br />	  <td>Actual Volume:</td> 	  <input type="text" name="av" size="5"><br />	  <td>Reject/Rework:</td>	  <input type="text" name="rr" size="5"><br />	  <td>Nett Output</td>	  <input type="text" name="no" size="5"><br /> 	  <td>Takt Time</td>	  <input type="text" name="tt" size="5"><br />	  <td>Downtime</td>	  <input type="text" name="downtime" size="5"><br />	   	  <input type="submit" name="doit" value="calculate"> 	 </form> 	 '; 	 }else{ 	  if($_POST['day'] == 'mon') 	  { 	   echo 'Your working hour is 495min';	   $result=495 - $downtime;	   availability($result);	   performance($not, $tt, $av, $result);	   quality($no, $av);	   oee($count2, $count4, $count7);	   }	    	  if($_POST['day'] == 'tue') 	  {	   echo 'Your working hour is 505min'; 	   $result=505 - $downtime;	   availability($result);	   performance($not, $tt, $av, $result);	   quality($no, $av);	   oee($count2, $count4, $count7); 	  }	   	  if($_POST['day'] == 'wed') 	  {	   echo 'Your working hour is 505min';	   $result=505 - $downtime;	   availability($result);	   performance($not, $tt, $av, $result);	   quality($no, $av);	   oee($count2, $count4, $count7); 	  }	   	  if($_POST['day'] == 'thu') 	  { 	   echo 'Your working hour is 505min';	   $result=505 - $downtime;	   availability($result);	   performance($not, $tt, $av, $result);	   quality($no, $av);	   oee($count2, $count4, $count7); 	  }	   	  if($_POST['day'] == 'fri') 	  { 	   echo 'Your working hour is 430min';	   $result=430-$downtime;	   availability($result);	   performance($not, $tt, $av, $result);	   quality($no, $av);	   oee($count2, $count4, $count7); 	  }	 }	 function availability($result){$count2= $result / $ppt;$count3= $count2 * 100;$count = number_format($count3, 0);echo 'Availability percentage is'. "$count" . "%";}function performance($not, $tt, $av, $result){$not   = $av / $result;$count4= $not / $tt;$count5= $count4 * 100;$count6= number_format($count5, 0);echo 'Performance percentage is'. "$count6" . "%";}function quality($no, $av){$count7= $no / $av;$count8= $count7 * 100;$count9= number_format($count8, 0);echo 'Quality percentage is'. "$count9" . "%";}function oee($count2, $count4, $count7){$count10= $count2 * $count4 * $count7;$count11= $count10 * 100;$count12= number_format($count11, 0);echo 'OEE percentage is'. "$count12" . "%";}	 	 	 	 	 	 	 	 ?>

Share this post


Link to post
Share on other sites

hey buddy can u plz give me d source codes for making premium calculator.....with monthly and yearly....plzz man itzz urgent......??????

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.