Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The lab6.php is a PHP page that: Defines a constant named MAX_ITERATIONS that contains a value of 100. contains a self-referencing/self-submitting form(to achieve this the

The lab6.php is a PHP page that:

  • Defines a constant named MAX_ITERATIONS that contains a value of 100.
  • contains a self-referencing/self-submitting form(to achieve this the action attribute on the page's
    tag should have or )
  • the form should be submitted in POST mode
  • this page should, the first time the pages loads in the default GET mode, create empty string variables named $start, $stop, $incr, $error and $output (respectively used to store: the start temperature; the stop temperature; the temperature increment; any error messages generated by the data validation; and, the generated table output).
  • has three (3) named text input boxes, one for a starting temperature, one for an ending temperature and one for the increment the user wants to increase the temperature by each.
  • when submitted in POST mode, should store the three (3) inputted values from the $_POST[] array in variables named $start, $stop, and $incr
  • performs a check that the data submitted is valid. Valid data means:
    • that the user entered something in each field (i.e. they are not empty)
    • that the user entered numbers in each field
    • that the start temperature is less than the end temperature
    • that the temperature increment is a positive (non-zero) number
    • If all the above conditions are met, you should verify that there would not be more than MAX_ITERATIONS number of loops, based on the conditions set by the user. NOTE: this can be determined by making sure that ($stop - $start)/$incr is less than or equal to MAX_ITERATIONS (after all other data validation is completed)
    If any of these conditions are not met, an appropriate message should be placed in the $error variable and no calculation should be done or a table created, but the error message should be displayed. If any invalid data is entered, it should be incorporated as part of the error, but the variable subsequently should be emptied off of the form (i.e. set the variable that is echo'ed in the form input's value equal to ""). NOTE: for full marks, your page MUST detect and display multiple errors (i.e. if a non-numeric input was entered for the start temperature AND nothing was entered for an increment BOTH issues should be flagged as a problem, this can be achieved by concatenating new errors to the end of the $errors variable).

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

More Books

Students also viewed these Databases questions

Question

Discuss laws affecting collective bargaining.

Answered: 1 week ago