=====
CS 328 - Week 13 Lecture 2 - 2025-04-23
=====

=====
TODAY WE WILL
=====
*   announcements
*   continue intro to PHP sessions: finish try-quad.php example
*   prep for next class

=====
*   should be working on Homework 10!
    *   at-least-first-attempts due by 11:59 pm Friday, April 25
    *   submit early, submit often!

=====

=====
REMINDER: PHP SESSION-SANITY HELPERS
=====
*   draw a FINITE-STATE DIAGRAM to describe your desired web application's
    behavior!
    *   (see posted photo of informal finite state diagram for try-quad.php)

*   have a helper function for each state in your application
    logic
    *   have the first version of each be a STUB, a little
        working version of the function that just
        proclaims what you called
	*   (and including an anchor element to
	    your PHP to continue is also useful)

*   START the postback PHP for your application with an if-elseif 
    that just lays out the order these will be called,
    
    setting up a $_SESSION key to keep track of the current state

*   try-quad.php - by the end of Week 13 Lecture 1, this just had such stubs,
    and such setting up of a $_SESSION key "next_state",
    BUT note that you can try it out and "walk" through the expected
    logical session

=====
REMINDER: a useful pattern in each state of a PHP application
    using sessions:
====
*   as you are writing the function FOR a state in your application:
	
    *   What information does this state need to GET (and SANITIZE/VALIDATE) 
        from a just-submitted FORM? (typically, from the $_POST array,
        if its method="post")

    *   What information from a PREVIOUS state does this state need to get 
        FROM the $_SESSION array?

    *   What information will a LATER state possibly need that this state 
        should ADD to (or update in) the $_SESSION array?

=====