logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA
Irish Culture
Home Finance


dailyclick
All times in EST

Full Schedule
g
g PHP Site

BellaOnline's PHP Editor

g

Personal Activities Calendar Program - Error Message For Missing Form Data - 2

Guest Author - Diane Cipollo

Now that we have completed the changes to the function call in the Activity Entry script, we need to add the changes to the Activity_Entry_Form function that will handle the error message. We need to add the new parameter variable to the list of variables being received by the function. If we don't, then the function will not recognize the $error_message even if we send it. So let's add the receiving variable called $prev_error_message to the list.

//print function with passed arguments
function Activity_Entry_Form ( $prev_error_message, $prev_act_title, $prev_act_desc, $prev_act_month_1, $prev_act_day_1, $prev_act_year_1, $prev_act_hour_1, $prev_act_month_2, $prev_act_day_2, $prev_act_year_2, $prev_act_hour_2, $prev_act_status )

Note--The code above is wrapped. It could really be all on one line.

When the value of the $prev_error_message is set to yes, we will want to display an error message on the form. We can do this with a simple if statement and a new variable we will call $message_text. This variable will hold the text of the error message. We will first initialize this variable to null. Then if the $prev_error_messaage is equal to yes, we will set the variable to the text of the error message.

$message_text = "";
if ( $prev_error_message =="yes" )
{ $message_text = "Sorry, please fill in all required fields <br><br>"; }
Note--The code above is wrapped. It could really be all on one line.

1. We have set the initial value of the $message_text to null. If the program has not encounter any missing data, the $message_text remains set to null and no message will appear in the form.

2. If the program has encounter missing data, we will set the $message_text variable to the error message we wish to show on the web form.

Finally, we will add the $message_text variable to the web form code in the location where we wish the error message to display. If it is not set to null, the message will be displayed.

...
<h1>Add An Activity</h1>
<form action=\"ActivityEntryStep4.php3\" ...>
$message_text

← Back







This site needs an editor - click to learn more!

Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Twitter Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Facebook Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to MySpace Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Del.icio.us Digg Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Yahoo My Web Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Google Bookmarks Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Stumbleupon Add Personal+Activities+Calendar+Program+%2D+Error+Message+For+Missing+Form+Data+%2D+2 to Reddit




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


For FREE email updates, subscribe to the PHP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 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.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor