|In the last part of the Personal Activities Calendar Program we built the PHP function that will send the Activity Entry web form to the browser. So far we used a PHP if statement to test if the web form has been submitted and if it hasn't, then the program will call the function which will send the form to the browser. |
However, we need to add one more thing to this step in the program. Because the form has not been submitted yet, the input fields used in the form do not have any data assigned to them. So we do not have any data to pass with the function arguments (which are variables). So we need to initialize these variables to null before we send them. (If you need to refresh you memory about PHP functions, arguments and function calls, read my previous article.) We will put the code that initializes the variables to null just before the function call. In the table below, the input fields used in the web form are in the column on the left and the names we will give to our argument variables are in the right column.
So far the if statement looks like this.
Now we need to write the code to initialize the variables.
Next we need to add the arguments to the function call.
Note--The arrow indicates that the code is wrapped to a second line and could really be all on one line.
Here are the finished changes to the ActivityEntry.php3 file.