Help me to edit and run this program that answer the fractional form using php html?
-
<html> <head><title>Act1</title></head> <body><form action="act1.php" method=Post> <p>Enter first numerator: <input type=text name=num1 size=20></p> <p>Enter first numerator: <input type=text name=num2 size=20></p> <p>Enter second denomenator: <input type=text name=num1 size=20></p> <p>Enter second denomenator: <input type=text name=num2 size=20></p> <p>Type of operation: <input type="radio" name="addition" value="x">ADDITION <input type="radio" name="subtraction" value="x">SUBTRACTION <input type="radio" name="multiplication" value="x">MULTIPLICATION <input type="radio" name="division" value="x">DIVISION <br> <p><input type=Submit value="Click Me" name=cmdclick></p> <?php function add($n1,$n2) { return $n1+$n2; } function subtract($n1,$n2) { return $n1-$n2; } function multiply($n1,$n2) { return $n1*$n2; } function divide($n1,$n2) { return $n1/$n2; } if ($operation==1) { $result=add($num1,$num2); echo "The result of adding the two numbers is: $result"; } if ($operation==2) { $result=subtract($num1,$num2); echo "The result of subtracting the two numbers is: $result"; } if ($operation==3) { $result=multiply($num1,$num2); echo "The result of multiplying the two numbers is: $result"; } if ($operation==4) { $result=divide($num1,$num2); echo "The result of dividing the two numbers is: $result"; } ?> </body> </html>
-
Answer:
First of all, change this: <p>Enter first numerator: <input type=text name=num1 size=20></p> <p>Enter first numerator: <input type=text name=num2 size=20></p> <p>Enter second denomenator: <input type=text name=num1 size=20></p> <p>Enter second denomenator: <input type=text name=num2 size=20></p> to this: <p>Enter first numerator: <input type=text name=num1 size=20></p> <p>Enter first denomenator: <input type=text name=num2 size=20></p> <p>Enter second numerator: <input type=text name=num3 size=20></p> <p>Enter second denomenator: <input type=text name=num4 size=20></p> Then based on the operation selected, implement the proper logic there (its basic math) and then your program will work. Good luck!!
mark79_2... at Yahoo! Answers Visit the source
Related Q & A:
- How To Build Business Directory Using Php Mysql?Best solution by Stack Overflow
- how delete node in xml file using php?Best solution by Stack Overflow
- How to read csv file using php?Best solution by Stack Overflow
- How to submit a form using httpurlconnection?Best solution by stackoverflow.com
- What is an easy code for a form in PHP?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.