Jump to content

Validating my form


Movies32

Recommended Posts

I'm trying to complete an assignment that has to validate my form when the user presses the submit button.  If you go to this website you can see the form that the user has to fill out:  http://www2.esc.edu/jvooris/assignment5-2.php?formChoice=1

 

As you can see there are several required fields that the user needs to fill in, however if the user presses submit without filling out the form there is no error message displayed.

 

My code does not seem to be working correctly and the only error I am getting is:

Undefined index: UserName

So, my question is how do I get this working correctly so that an error message displays if certain fields are not filled in?  Any help would be greatly appreciated.  I will attach my php files.  I know I have only added the UserName error so far in the form-to-email file because I was trying to get one working before adding all the other errors.  Thanks.

assignment5-2.php

form-to-email.php

Link to comment
Share on other sites

I was finally able to get the errors to show up, but now my problem is that all the errors show up when the user presses submit.  For instance, if the user enters all the necessary information into the Help Form then the errors for the Feedback Form will show up even though the user only wants to enter information into the Help Form.  The same goes if the user just wants to enter information into the Feedback Form.

 

Does anyone have a suggestion of how I can code this so only the right errors show up at the right time?

 

Also, how could I check to make sure that one of the checkboxes is checked in the Help Form using the same method?

 

 

assignment5-2.php

form-to-email.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.