How to Create Responsive Registration Form in Bootstrap

How to Create a Registration Form in Bootstrap?

Bootstrap makes each of its forms fields responsive, that's why most people use the bootstrap form. Here we have made a basic simple form that is responsive. You don't have to do much just copy and paste the below code and create a responsive form. 

responsive registration form in bootstrap

So let's start, first of all, create a folder inside your C:\xampp\htdocs named register-form, keep in mind the location of your file should be C:\xampp\htdocs/register-PHP/

We will create a file inside the register form named register.php, you can name it whatever you want and you can keep any name of the folder.

note - Make sure your localhost like xampp is on

Open the register.php file in any code editor like sublime, VSstudio, or note++ because we are going to write the code inside it.

After opening the register.php file, inside it, copy the code given below and paste it into your register.php file.

Here we have used Bootstrap 5's CDN which makes the form more attractive.

After pasting the code, go to any web browser and type http://localhost/register-form/register.php in the URL bar. Now your registration form will be appearing like this

See the Pen Untitled by Ramkrishna Sahu (@ramkrishna-sahu) on CodePen.

After pasting the code, go to any web browser and type http://localhost/register-form/register.php in the URL bar. Now your registration form will be appearing like this ↑

Congratulations! Your Responsive Register Form is ready. Now let us understand its basic code

Understand The Basic Code of  Registration Form

In the above code, first, we have defined the HTML documents type, after that link the CDN of bootstrap 5 inside the <head> section, if you want, you can also use the CDN of bootstrap 4, 3, this CDN in designing the form Also in the footer we have linked the script of Bootstrap which will help in validating the form.

Now come inside the tag, here we have given a class name to the form tag as well as used the needs-validation element, this validation will work when the input field is empty and submitted by the user.

You can use different validation classes to provide valuable feedback to users. Add either .was-validated or .needs-validation to the

element, depending on whether you want to provide validation feedback before or after submitting the form. The input fields will have a green (valid) or red (invalid) border to indicate what's missing in the form. You can also add a .valid-feedback or .invalid-feedback message to tell the user explicitly what's missing, or needs to be done before submitting the form - according to w3school

<lable> tag is used to name the input field whose main element is "for" attribute. If enterfirstname"> the First name is placed then id="enterfirstname" of the input field should be the same means that the label has to be connected to the input field.

The next tag is the input tag. The bootstrap class form-control of this tag will control the design of the entire form and we have added the rounded-pill class which will make the border of the input field in a rounded shape.

Similarly, if you want to take input from all the users, then copy and paste the same code for each and change its field name.

Finally, on the submit button, here is a button type submit button, using the class of bootstrap, whose name is submitted or you can name it anything.


In the Next Tutorial Will look at the form validation and do everything carefully. If you face any problems related to this tutorial, then please write in the comment box below, and we will help you as soon as possible.

Simple Registration Form Source Code in Bootstrap

Source Code Registration From Download Now

Thanks For Reading........