Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
We are now going to take a look at the registration page, for our login process. The idea is, this is for users of the Scuba2u website, can come in and register to become a member of our website when they do that, that registration page is going to insert their information into our login table. They will then be taken to the login form, in order to login and they must enter their credentials that they submitted with the register form.
So, that's the idea behind the process we're working in right now. So I have the register page available, and this is another page, like our login form, that was created by the website designers and maintenance people for Scuba2u. We have been tasked with making this process workable on the website. So we're going to take their form and just like we did with the login form, we're going to make sure that this form makes sense and has all of the details we need, in order to insert their information into the database.
And make sure that their role gets registered as a guest. So let's go through these form fields real quickly. Now, first name in this field is set up to 30 characters wide. Our database can handle 40. So in the max characters, I'm going to enter 40 in this area. Character width is what's showing to the user. I don't need to make the box look bigger to the user, I just want to make sure that they can enter up to 40 characters. I'll do the same thing with last name, and we have the same situation, so I will set maximum characters to 40.
Last name has its own field, and our last name looks like it's only 11 characters, which could become a problem within our database. So we will need to address modifying that to 40 characters as well. So, we'll have to go out to the database and modify that value for last name within, the database itself. But for now we'll set it to 30 and 40 just like first name. Our phone number field has a bit of an issue here. Now do we really need phone number.
Well, when the database was set up, it doesn't look like we were planning on doing that. So, I'm going to delete the phone number field. From this registration form. Somebody may have made a change in some of the requirements, and our form does not reflect that. What we do have in our database, is the country and within the country area We don't have a country on the form. So, let's modify this form accordingly.
Now, this phone number piece I'm going to change the text here for our phone number, and have it say country instead. Now when I do that, I need to make sure I also change the name of the text field. I will set that to country now our country is also only 11 characters, countries will require more than that so I'll set the character width here to 20, and actually 20 probably isn't enough let's switch country to 30 maximum characters.
And in order to make it look nice to user, we'll do the same in the form itself. Now, our city is here for a 30 notice we don't have a city here, so the people who created this form must have changed the requirements, so I can completely eliminate the entire city piece. I'll select it right here, and delete that. And I will also delete all of this text within our form.
Now, this can tend to happen quite often. Somebody creates the form over the course of time before I get the form, it's different. So, it's very important to go through. And make sure that this information is correct. So, we know we need to modify in our database the country field, and the last name setting those to different values, and we will set the last name field in the database to 40 and our country to 30. So I'll have to go modify the database within PHP MyAdmin. Here we have our email and our password.
Now the last piece, let's say we have country, first name, last name. We have password and user name. Our user id will be assigned automatically by the database. Every user id must be unique. This is not as our primary key. You can see there's a little key next to this field. The only thing we haven't addressed, is assigning a guest rule for our user. I also should probably have our submit button not say submit. But I will say register.
That looks a little bit nicer. Now how can I get information into the database without the user being able to modify it? What I'm going to do, is put in what's known as a hidden form field and assign it a value of guest. Now this hidden form field can really go anywhere on your form. It can go below the form tag or it can go down here. I tend to not put it in between the fields. Sometimes it's hard to see. So since I have register selected already I'm going to hit the left arrow key on my keyboard.
And my cursor is now directly in front of this button even though it's hard to see. I'm going to go up to the Forms tab and click this third icon here. And it says Hidden Field. And I'm going to set to role as the name. And our value is going to be assigned a value of guest. Anybody coming from our website, is going to get the value of guest in the role area.
So, that is our hidden form field. Now let's make sure that's correct. I'll right-click and view data for our log in and you can see here is role. And they've been assigned either admin or guest. So this form should be all set. We now need to go up to the database, and modify our country and last name columns accordingly. Our register form should be all set to go.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101003 Viewers
61 Video lessons · 87798 Viewers
71 Video lessons · 71674 Viewers
56 Video lessons · 103561 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.