Personal Activities Calendar Program - Error Message For Missing Form Data
|In the last tutorial, we wrote the part of the Activity Entry script that will handle the possibility that the web form has been submitted but the user has not supplied all the required data. First, we set the values for the variables that we will pass to the Activity_Entry_Form function. The value for each variable is set to null if the input data is missing and, if not, it is set to the value of the $POST[''] data. Finally, we set the $error_message variable to yes if there is missing data from any of the required form fields. This will tell the program to display an error message when it displays the web form again. Now, let's work on handling the error message.|
There are two changes we need to make to the Activity Entry script. Because we will be passing this new $error_message variable with the function call, we need to add this variable to the list of parameter variables that are sent to the function.
Also, because we will be coding the Activity_Entry_Form function to expect this new variable every time it is called, it will be expecting it even when the form is displayed for the first time. Therefore, we need to add the variable to the function call in the first part of the script. But we can't send this variable without initiating it first. So let's add that to the code too.
This site needs an editor - click to learn more!
Editor's Picks Articles
Top Ten Articles
Content copyright © 2019 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.