New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Dynamic Dreamweaver Websites: Creating and Validating Forms
Illustration by

Fixing "fields not submitted" errors


From:

Dynamic Dreamweaver Websites: Creating and Validating Forms

with Candyce Mairs

Video: Fixing "fields not submitted" errors

I'm now going to talk about the difference between some of these form fields and things you need to keep in mind as a developer when you're working in the various types of form fields. So we'll take a look at what the different types are that we have on our form. Right now, within this form, we have text fields, we have a drop-down menu, we have radio buttons, check boxes, and a text area.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Dynamic Dreamweaver Websites: Creating and Validating Forms
3h 34m Intermediate May 19, 2011

Viewers: in countries Watching now:

Forms perform an essential function in modern websites, making it possible to gather information from users and validate that information. In this course, Adobe Certified Expert Candyce Mairs shows how to create forms to email user information and validate user data using various methods of form validation. These validation methods include client-side, server-side, and custom validation; CAPTCHA images; and Spry validation fields. You'll also see how to set up a PHP testing environment and preview PHP pages in Dreamweaver. Along the way you'll build your skills in areas like using admin consoles, commenting code, working with variables and includes, and much more.

Topics include:
  • Installing XAMPP on a Windows system
  • Installing MAMP on a Mac system
  • Using admin consoles
  • Creating PHP pages
  • Commenting code
  • Working with web forms
  • Adding custom validation
  • Using redirects
  • Dealing with email issues
Subjects:
Developer Web Web Design Web Development video2brain
Software:
Dreamweaver
Author:
Candyce Mairs

Fixing "fields not submitted" errors

I'm now going to talk about the difference between some of these form fields and things you need to keep in mind as a developer when you're working in the various types of form fields. So we'll take a look at what the different types are that we have on our form. Right now, within this form, we have text fields, we have a drop-down menu, we have radio buttons, check boxes, and a text area.

So we do have quite a few forum field types. Now, those form field types, it makes a difference when you're trying to work with them on the Action page. If I put this in the browser, you'll see what I'm talking about. So I have my form, I'm not going to fill anything out. If I click Contact Us, we have a problem. So lets take care of this problem first. Now, notice our form fields, which are text fields, didn't have a problem. Our topic, let me move this over so you can see, our topic specifically is a drop down menu...

We didn't have a problem with that. Present customer, our radio buttons weren't a problem either. That's because of these different features as long as it's a single selection drop-down list, and I have something checked initially when I fill out the form. In other words, I have one of these radio buttons preselected for the user. In this example, I don't. But if I did, we would not have a problem with these four form fields. What we have a problem with is if the user doesn't choose a check box at all, that check box information does not get sent to the action page. So I don't have anything listed in Tour Date.

I'm getting an error. Let me fill it out with a Tour Date, and you'll be able to see that. So I will use the Populate Form Fields option. This is the Web Developer toolbar. If you're stepping into this movie and don't have this toolbar installed, so I will use, Form > Populate Form Fields, fills out all of the form fields for me. I'm going to uncheck these.

So I'll just send two, click Contact Us Notice tour dates shows up, but if I go back to the form and don't check anything we do not get the text, we get an error. The text is listed down below it, but here's our problem. So line 15 is what's causing the problem. What happens is this function we have set up in PHP is trying to perform or do a task and there is noting to do the task on.

So we can fix that fairly easily but we do have to do some coding ourselves in order to do that. So the coding we're going to do is on the Action page. And what we need to do at the top of the Action page is. We want to make sure that the user set up some information before we try and use the implode function on it. So, within our PHP color block, we're going to type out what is known as a conditional statement. And here is the basic skeleton of a conditional statement. It has the word if, it has parentheses, and then curly brackets. The first curly bracket goes to the left.

The little point in the middle of the bracket is going to the left-hand side and this one is going to the right side. And what we're going to do is put some information inside of here. We want to test to see if our tour date form field had been sold out. So if its not filled out then we're going to do something. So this means if something is not filled out in our form. So we use Not and the Is set function to set this up. So what are we going to test for? We're going to test for a variable coming from the form, so it's a post variable.

And the post variable we're going to use is Tour Date. Why did I choose that one? Well that is the one that could cause a problem. We're trying to use the implode function on it and it doesn't exist. So lets go ahead and add this, so post Tour Date. Notice that I no longer have syntax errors. So if tour date is not coming from our form, we're going to do something. And what we're going to do is $_post. We're going to take that Tour Date.

You can just copy it from up above if you'd rather not type. And we're going to assign it to array. So there's our code. If the user filled out the tour date, this will not run. So what happens is in an if statement, it's testing to see if this is true. So what is it we're testing? We're testing to see if the user didn't fill out any check boxes for tour date. If they didn't, we're going to create a variable and we're going to assign it to no values.

That will make sure that this exists before we try and do something with it. So this will prevent that error. Let's go back to the form. I'll put in in Firefox, only because I can use the Populate Form Fields. I will uncheck our check boxes now, because that's what we're testing for. Click Contact Us and we do not have a problem. You can see, it shows up empty. If we go back to our form and check them, and this is something to consider as you're moving into PHP or any server side language.

When you add something new, don't always assume that the old stuff is working that you had already tested. Always go back and test it as well. So I will test it with the check boxes as well. Not a problem. Without the check boxes, not a problem. So we're all set on our form. Tour dates is not going to cause us a problem. Any time you work in check boxes, it can become an issue, so it's important to plan for that in advance. Now, if we fill out our form here, what would happen if no radio buttons are selected? Radio buttons are not an issue for us so in this example we won't have to worry about those. If the user doesn't select them it's not a problem. We're not trying to perform something on that value. We just won't get a value printed.

So that is working with check boxes. Also how to test for our form variable, or any type of variable actually, to see if it exists before we try and do something. So you could put any variable in this area after is set. Whether it's a form variable or not. Whatever you're going to put inside those parentheses. It's going to test and see if it exists. If it doesn't exist. Because, we said, if it's not existing. We can put in here what to do if it doesn't exist. And what we're doing is creating that variable, and setting it to an array variable in PHP.

That way we know this is always going to exist. So, our implode function down below will work properly. So that is working with check boxes on a form.

There are currently no FAQs about Dynamic Dreamweaver Websites: Creating and Validating Forms.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dynamic Dreamweaver Websites: Creating and Validating Forms.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.