(Self Submitting) Form Structure

    Date: 10/30/07 (PHP Community)    Keywords: php, css

    I have a Form that resides right in the middle of some fairly complex CSS created by another person. 
         (I talked him into letting me practice on his code!)

    • The Form is called with an include statement
    • The Form is actually two pages long, with the second page being created dynamically based on selections in the first page.
    • It’s all contained in one php file that submits to itself.
    The structure is as follows:

    If page 1 submitted
         Check/Sanitize results from Page 1
              If fail set error variables continue on
              If pass
                     Set "Page One Pass" variable and  continue on
    If page 2 submitted
         Check/Sanitize results from Page 2
              If fail set error variables and continue on
              If pass give “Thank You”
                     Set variable to prevent Page 2 from drawing
    Check for “Thank You” variable, if it doesn’t exist
    Check for "Page One Pass" variable, and if it does exist
          Draw Page 2
               Set "Page 2" draw variable
    Check for Page 2 and “Thank You” variables, if they don’t exist
         Draw Page1


    I was speaking to a programmer friend of mine (who doesn’t work in php), and he suggested that I write sequentially.
    Example:
       Draw Page 1
       Check Page 1
       Draw Page 2
       Check Page 2
           If pass give “Thank You"

    But I can’t see how to do that without using Functions, and with Globals turned off—it’s kinda’ a pain.
    I thought about using nested While Loops, but that seemed more confusing.

    I don’t know if what I just wrote is even remotely understandable…but if you can make sense of it, I’d love to hear your thoughts!

    Thank You!

    Source: http://community.livejournal.com/php/592984.html

« code obscurity is always fun || Parsing XML »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home