Jump to content

khyzer

Members
  • Posts

    3
  • Joined

  • Last visited

khyzer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <!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>Untitled Document</title> <script > function width() { var width = screen.width; document.getElementById("width").innerHTML="screen width is :" + (width+1); } </script> </head> <body onload="width()"> <div id="width">xbcbcvbc </div> </body> </html>
  2. use brackets 1.if u wants add first two numbers then multiply with 0.01 use this if (count($_POST) > 0 && isset($_POST["calc15TextArea2"])){ $sum = ((floatval( $_POST["indexEditbox1"] ) + floatval( $_POST["indexEditbox2"] )) *.01 )+ floatval( $_POST["calc15Editbox3"] ) + floatval( $_POST["calc15Editbox4"] ) ; echo "Total is $ $sum"; } 2 if u want multiply only second number with 0.01 then use this if (count($_POST) > 0 && isset($_POST["calc15TextArea2"])){ $sum = floatval( $_POST["indexEditbox1"] ) + (floatval( $_POST["indexEditbox2"]) *.01 )+ floatval( $_POST["calc15Editbox3"] ) + floatval( $_POST["calc15Editbox4"] ) ; echo "Total is $ $sum"; }
  3. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Calculator</title> </head> <body> <p> <form method="POST" action=""> First Number : <input type="text" name="x"><br /> Oprator :<select name="operation"> <option value="+">+</option> <option value="-">minus</option> <option value="*">*</option> <option value="/">/</option> <option value="sqrt">square root</option> </select><br /> Second Number :<input type="text" name="z"> <input type="submit" name="result" value="result"> </form> </p> <?php if(isset($_POST['result'])) { switch ($_POST["operation"]){ case '+': $answer="Sum is : " . ($_POST['x']+$_POST['z']); break ; case '-': $answer="Subtraction is : " .($_POST['x']-$_POST['z']); break ; case '*': $answer="Multiplication is : " .($_POST['x']*$_POST['z']); break ; case '/': $answer="Division is : " .($_POST['x']/$_POST['z']); break ; case 'sqrt': $answer= "Sqrt of first input is : " .(sqrt($_POST['x'])); break ; } echo $answer; } ?> </body> </html>
×
×
  • Create New...

Important Information

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.