HTML Form Validation Required and Email Attribute

This lesson is exclusive to members

Questions

Course info

13 lessons / 1 hours

Overview

Hi, In this course we are going to add a newsletter sign up form that will save our new subscribers to a database.

To do this we are going to be using a backend programming language called PHP and a MySQL database.Don’t worry if that doesn’t make any sense to you, we will be going over all of the basics and walking you through it step by step.

This course does however assume you have a basic understanding of html and css, and that you know how to push any updates up to a server and make them live.

If you don’t have that experience then I can recommend this course by Daniel Scott, it starts at the very beginning and will easy get you up to speed so you can start taking the next steps like working with PHP and databases.

So if you’re ready to get started with our PHP database project … then sign up to the course and lets get started :)
Daniel Scott

Daniel Scott

Founder of Bring Your Own Laptop & Chief Instructor

instructor

I discovered the world of design as an art student when I stumbled upon a lab full of green & blue iMac G3’s. My initial curiosity around using the computer to create ‘art’ developed into a full-blown passion, eventually leading me to become a digital designer and founder of Bring Your Own Laptop.

Sharing and teaching are a huge part of who I am. As a certified Adobe instructor, I've had the honor of winning multiple Adobe teaching awards at their annual MAX conference. I see Bring Your Own Laptop as the supportive community I wished for when I was first starting out and intimidated by design. Through teaching, I hope to bring others along for the ride and empower my students to bring their stories, labors of love, and art into the world.
True to my Kiwi roots, I've lived in many places, and currently, I reside in Ireland with my wife and kids.

Downloads & Exercise files

Transcript

In this video, we're going to add some validation  to our form to stop it being submitted while empty. So something we forgot to look at was  stopping our form from being submitted while the  inputs are empty. You'll see if I hit the submit button. Now it submits  and it goes back to the homepage, which is good. But if we have a look at our database, you can see  that it's submitted with no name or email. So what we're gonna do is go back to VS code.

And if we have a look at our two inputs here,  just on the end, if we add in required  and also add in required on that one too, and we'll save. Go back to our site, refresh the page, and we see. Now if I try to submit that, it's gonna ask to say,  please fill in this field. We try it again. It's gonna ask me to fill in that one. And also because we have, if I go back to the code,  because we have given this one a type of email,  it's also gonna validate  that we put an email address in there.

So if I try to submit that one, it's gonna say,  please include an at symbol in the address. So let's add in a proper email address, hit the submit,  go back to our database,  and now we can see that it's adding a name  and a correct email address.
  • Powered by Marvin
  • Terms of use
  • Privacy policy
  • © Bring your Own Laptop Ltd 2025