Personal Activities Calendar Program - Printing The Web Form With A Function - 2

Personal Activities Calendar Program - Printing The Web Form With A Function - 2
To make the program easier to maintain, let's put the code for this function in a separate file. Let's call that file ActivityEntryForm.php3 and let's call this function Activity_Entry_Form( ). Here is the beginning of the function code.

function Activity_Entry_Form( )
{ … echo statement … }

Now we need to add the echo statement.

function Activity_Entry_Form( )
{
echo "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
...
<form>
...
</form>

</body>
</html>";
}

That's all for now, save your file as ActivityEntryForm.php3.

Now we need to go back to our original ActivityEntry.php3 file and make some changes. Remember that we need to remove the echo statement and replace it with the function call for the Activity_Entry_Form( ) function. We also need to add a require_once statement to include the ActivityEntryForm.php3 file. Here is the finished changes to the ActivityEntry.php3 file.

require_once('ActivityEntryForm.php3');

if(empty($_POST['submit']))
{
Activity_Entry_Form( );
}

← Back








This site needs an editor - click to learn more!



RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map





Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.