Friday 15 March 2013

php - codeigniter build a calculator -


I am trying to create a calculator in PHP which will go to a Codeigniter controller. I have a form in HTML that receives numbers.

  & lt ;! DOCTYPE html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Calculator & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form action = "calc.php" method = "post" & gt; & Lt; Input type = "text" name = "num1" & gt; & Lt; Input type = "text" name = "num2" & gt; & Lt; Input type = "text" name = "num3" & gt; & Lt; Input type = "submit" value = "calculation" & gt; & Lt ;? Php echo form_close () ;? & Gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

I have a formula on which the calculator will work on which I call Have tried the layout on the PHP page.

  if (isset ($ _ POST ['value'])) {$ num1 = $ _POST ["num1"]; $ Num2 = $ _POST ["num2"]; $ Num3 = $ _POST ["num3"]; } Function Count () {$ c = $ num1 / 50; $ B = $ points 2/12; $ S = $ num3 / 5; $ P = $ c + $ b - $ s; If ($ s> 4) {$ s = 4; }} Echo $ c "+". $ B "-". $ S = "; echo $ p;   

I do not think I am doing this very right.

No comments:

Post a Comment