Homework 2

 

Sum of Powers Sticky Form (50 PTS) 1.  Create a sticky form that gets two inputs from the user
  • the number of positive integers, from 1 to N, they want to sum
  • the power that each term should be raised to before summing
    • the computation for finding the power of each term should be done in a separate function that
      • passes the base
      • passes the power
      • returns the result

Then you should display the result in a third text box.  You should call the page sticky_sum.php.

Sticky Form (50 PTS) 2.  You need to create a sticky form called sticky_inputs.php that does the following.

  • gets a username
  • uses a group of radio buttons to determine which sort of credit card they will use to pay
    • Discover
    • MasterCard
    • Visa
  • presents some check boxes for the user to click for their favorite past times
    • partying
    • sports
    • studying
    • travel
  • uses a list box to assign a range for their annual income
    • less than 20000
    • from 20000 up to 40000
    • from 40000 up to 60000
    • more than 60000
  • gives them a text area to describe themselves

You also need to do some input validation to make certain they have entered something for the username, selected at least one card type to use for payments and selected some income range.  If they haven't, you need to give them appropriate feedback on the page above the form.  If they have supplied all the required information you need to tell them this.