Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Write a php page that prompts user to enter an equation. When the user hits the submit button, the entered equation will be validated and

Write a php page that prompts user to enter an equation. When the user hits the submit button, the entered equation will be validated and evaluated in the same page. If the equation is valid, then it will be evaluated and the result is displayed on the page as shown in the following figure:

image text in transcribed

Please note the following:

  • The entered equation is valid if and only if:
    • It is written in the following sequence: a first operand, followed by an operator, and finally a second operand.
    • The first operand is an even number greater than or equal 0.
    • The second operand is divisible by 5 and greater than or equal 0.
    • The operator could be +, -, *, or /
  • E.g.) the equation 3+995 is invalid, but 466+45 is valid
  • The validation discussed above should be implemented only using regular expressions and the preg_match function.
  • If the equation is invalid, the error message Please enter a valid equation is displayed
  • image text in transcribed
  • JavaScript code is not allowed.
  • the value of the input field is kept when the user hits the submit button .
22+555 Enter your equation: The result is: 577 Submit 22+5553 Please enter a valid equation Enter your equation: The result is: Submit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students explore these related Databases questions