Question: Part 3 : Sign-up form The idea is the same as part 2. Students must: Have a form that contains at least 2 input fields:

Part 3: Sign-up form

The idea is the same as part 2. Students must:

  • Have a form that contains at least 2 input fields: username and password.
  • The error message or success message are hidden before the user click submit buttons.
  • You should apply some rules for the format of either username or password.
    • You can search google for the pattern youd like to have on your website
    • User preg_match() function to match the pattern and the form data
  • There should be messages:
    • Error message for empty field.
    • Error message if there is invalid username/password
    • If there is no error, display a success message saying that the user signed up successfully.
  • If the new account is valid, append the new account to the database:
    • Read the json file and decode to an associative array.
    • Use function array_push() to append the new account to the array. NOTE: the new account should be in a small array with the same structure as the decoded array.
    • Use function file_put_contents() to write the new json string into the original file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!