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

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Inserting new members

From: Dynamic Dreamweaver Websites: Creating Login Areas

Video: Inserting new members

At this point in our course we have the pages set up to Register and Log in. We have quite a few separate pieces created. Now what we need to do is start adding a functionality. So we're going to move over to our Register.PHP page. As of right now this page does not have any form validation on it. I could convert these text fields to Spry text fields but I purposely kept validation off of this page. So we could focus on adding new users and it just makes it easier when you find out the form.

Inserting new members

At this point in our course we have the pages set up to Register and Log in. We have quite a few separate pieces created. Now what we need to do is start adding a functionality. So we're going to move over to our Register.PHP page. As of right now this page does not have any form validation on it. I could convert these text fields to Spry text fields but I purposely kept validation off of this page. So we could focus on adding new users and it just makes it easier when you find out the form.

Do not have to always have everything in perfect in order to make sure that a user can go into our database. Now in the databases area the Login table is were we want to add people for this page. Now if something happens and they cannot register, we should probably have a page for that, especially if they are already registered. So I'm going to go down to the Template page and here is our Registration Form.

And I'm going to say, Registration Form, "Registration Did Not Work." And that's all we're going to put on this page. Actually, let's add register again. Let's setup try and register again. Now if this was a real true functioning page. We would want to set this up a little bit better but I don't want to focus on that piece right now I will save this as Register, Register failed let's just call it that. Now, this isn't really a page name I'd want to use for a user but that a let us know which page it is.

That's why we said registration did not work. Okay. So if they try and get entered into the database and it doesn't work, this is the page we're going to send them to. So how do we do that? I'm going to select the Register button, and we will go over to our Server Behaviors. Dreamweaver Server Behaviors are going to add all of our functionality for us. Now technically what we're doing within this Registration form is adding a new user to our Login table. So we can use the Insert Record server behavior, and when we do we need to tell Dreamweaver what we're going to attach it to.

So the user fills out this form, they click the Register button, that's when we want this to insert the data into the database. So the server behavior is going to be Insert Record. Now here is our form name, so the values from this form it would be best if we set up a specific form name. But since we only have one form it doesn't matter from a functionality stand point. Our connection is going to be our log in connection.

It's the only one we have. We want to insert them into our Login table. Now as soon as I chose that table. What Dreamweaver is going to do here is try and match up all of the fields in our table in the database with the information within this form. Now we have a Username. Username does not get a value. Well, Username is going to become the email. Or should I say, the email address is actually stored as Username.

Since our form field is named email. And our field in the database is called Username. These two do not match up automatically inside of Dreamweaver. If my Form field names are exactly the same, Dreamweaver will automatically know what data to put in what field. So all we have to do, right here, is the Username does get a value, it's just a field not named Username. So I will select that one, and right here I can chose the correct value.

So I will go down, and notice these all say form so the form field called email is going to go into the Username category. Now usually if you are going to insert data into a database table you want to do it in this manner. Where you insert all of the fields Into the database specifically. So Country, Country, Last Name, First Name, role, Password and User ID is simply the row number.

Now after inserting where are we going to send them? Well provided the insert works we want to send them to our Login page. And this is why you want to have these pages already created, so they register. Moves them onto the Login page, where they can use that Login to authenticate against their new record in the database. So let's click Okay. Now there is a bunch of code that's been added to the page.

And we should see Insert Record within our Server Behaviors. I will save this page and let's go out and test it in the browser. Now I'm going to insert myself and I am going to put a correct value in here. I want to put myself correctly into the database. And for my password, I'm just going to use the same name as the form field PWD, all in lowercase just to make it easier. When I click the Register button.

This does ask if I want to remember the password. I'll just ignore that. Notice I am taken out to the Login form. That should mean that I was inserted correctly. So let's go out to our Login table. And let me select that. And then right-click to View Data. And there used to be only four fields within this area, now there are five. And this is one reason why I kept these blank for you, it's easier to tell if your information has been inserted into this area. Now, we are going to build an Administrative section. Where an administrator is able to change somebody from a guest to a an admin. So that is why I wanted to insert my correct information. But our registration form is all set.

Now, let me go out and try and register again. If I go to do that, there is nothing stopping me from doing that. So I'm not actually going to do it. Feel free to try to do it. But you can put your Username or your email address in as many times as you want now. We will add one last piece to this Register button. What we want to do is make sure that there is no other user with that same e-mail address, and it's simple to do this.

I'll select the Server Behaviors, click the plus. I'm going to go down to User Authentication. And I'm going to say, Check New Username. The Username field is the email field. And if it already exists, I'm going to send the user to our Register failed page. Now, I don't have any information on that right now. Specifically saying that your Username has already been taken, we'll just make sure that we get send to that page. So I will Save this, go out to Preview, put my information in once again. Exact same information and it won't let me put the password in by double-clicking in Firefox.

I will go to Register and notice I am sent to the Register failed page. Make sure when you're testing, you test for both pieces. That it failed and it did not. We now have our Registration forms set up very easily thanks to two Server Behaviors built into Dreamweaver.

Show transcript

This video is part of

Image for Dynamic Dreamweaver Websites: Creating Login Areas
Dynamic Dreamweaver Websites: Creating Login Areas

43 video lessons · 1556 viewers

Candyce Mairs
Author

 
Expand all | Collapse all
  1. 1m 32s
    1. Welcome
      1m 32s
  2. 2m 57s
    1. Course overview
      1m 16s
    2. The course environment
      1m 41s
  3. 26m 58s
    1. Static vs. dynamic requests
      4m 8s
    2. Installing XAMPP on a Windows system
      8m 54s
    3. Installing MAMP on a Mac system
      4m 29s
    4. Using admin consoles
      3m 54s
    5. Installing the course files
      5m 33s
  4. 18m 36s
    1. Overview of the Dreamweaver interface
      6m 22s
    2. Setting up the course site
      6m 20s
    3. Previewing pages
      5m 54s
  5. 33m 38s
    1. Creating PHP pages
      5m 45s
    2. Adding PHP code
      5m 44s
    3. Displaying variables
      4m 45s
    4. Commenting your code
      5m 30s
    5. Working with includes
      5m 58s
    6. Building the course templates
      5m 56s
  6. 35m 13s
    1. What is a database?
      5m 2s
    2. Adding database tables
      7m 34s
    3. Connecting to the database
      8m 28s
    4. Getting data from a database: Part one
      8m 25s
    5. Getting data from a database: Part two
      5m 44s
  7. 1h 16m
    1. Planning the login process
      7m 25s
    2. Creating a login form
      7m 45s
    3. Adding form validation: Part one
      9m 22s
    4. Adding form validation: Part two
      1m 37s
    5. Exploring the registration page
      7m 17s
    6. Correcting table fields
      6m 1s
    7. Setting up the login landing page
      4m 1s
    8. Using server behaviors
      3m 36s
    9. Inserting new members
      8m 48s
    10. User authentication
      10m 3s
    11. Restricting access to pages
      5m 17s
    12. Testing the login
      4m 53s
  8. 1h 6m
    1. Admin area overview
      5m 9s
    2. Adding new users
      5m 19s
    3. Restricting access
      12m 25s
    4. Planning the admin update area
      5m 19s
    5. Building the members table listing
      6m 55s
    6. Building the querystring
      9m 14s
    7. Populating the update form
      6m 33s
    8. Updating the database data
      11m 28s
    9. Testing the admin update process
      3m 47s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

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.