Introduction to PHP for Drupal Tutorial #9: PHP Functions Continued
In this 9th PHP video tutorial, I show you how we can use functions from a separate file to make our code a little cleaner. Here, we create a form which allows users to enter a position and name to add to a starting player lineup. Using the session variable to retain the players entered, we pass the session and post variables to our functions which look at whether the post variable was filled out, whether the form was reset, and finally update the roster. We also use a custom function to print out our lineups which also relies on two foreach loops in case we have multiple lineups.