Form Đăng Ký Tài Khoản Bằng Php Form Trong Php, Form Đăng Ký Tài Khoản Bằng Php

Many WordPress plugins come with fully functional contact forms that can be installed và used right away, but we believe in beautiful design và in your right to style it however you choose. Therefore the first clip will focus on how lớn create, but mainly how khổng lồ style, your tương tác form using CSS3.Bạn sẽ xem: Php size tutorial

Your Designer ToolboxUnlimited Downloads: 500,000+ website Templates, Icon Sets, Themes và Design Assets



There is not much HTML5 in this video clip tutorial, as the liên hệ form is built with code available in previous versions of HTML, but you can use this first đoạn clip tutorial as a way to lớn reinforce many of the things we learned together in the previous tutorials. So without any further discussion, here it is.

Bạn đang xem: Form Đăng ký tài khoản bằng php form trong php, form Đăng ký tài khoản bằng php

Contact khung HTML và CSS Tutorial For Dummies

What you will learn:

the basics of CSS3 stylinghow to lớn create an HTML5 liên hệ formhow khổng lồ create an elegant CSS3 contact form


By the end of this HTML liên hệ form tutorial, you will have something similar to lớn the screenshot above. Feel free to view the chạy thử just after the video tutorial to get a feel of what you will be making in under 25 minutes. It’s a good exercise for both beginners và experts alike!

Challenge: Making contact Form Responsive & Validation

Can you make this tương tác form responsive? I will give you a hint, but it will be somewhat irrelevant to a liên hệ form, but surely you are smart enough to work your way through it, yes?

Hint: It’s all about the truyền thông media queries!

Of course, it is crucial that you validate the fields so that you will not receive any unnecessary information, or secure that all the information you need from your contact form are all useful. In order to bởi vì that, you will need lớn include HTML5 validation in your code. It is pretty easy khổng lồ do, all you need is patience & the willingness to chạy thử new stuff!

How to lớn Make the contact Form HTML Work

Although making it functional will require a little bit of server-side programming, I’ll be glad khổng lồ point you in the right direction!

To make this form function for your website, you’ll need khổng lồ code it with PHP.

Note: the PHP liên hệ form tutorial focuses on just making it work functionally, but you will just need to add security features lớn it yourself (Google it!).

Good luck!


I am sure that almost everyone can agree on the importance of contact forms for use on everything from static HTML websites lớn WordPress powered websites. I found myself many times creating custom PHP contact forms for clients & always changing things around lớn suit the needs of the client.

After going through this tutorial, you should have a better understanding of creating custom PHP liên hệ forms. These can be really useful in your own projects, as well as projects for clients.

I have used these for basic contact forms, surveys, & even khổng lồ create simple help desk ticket systems for clients. The danh sách is endless, just be creative. I will discuss everything that you will need khổng lồ know khổng lồ make your own custom HTML and PHP forms.

View the chạy thử and tải về the Source Files.

How to lớn Create a Simple PHP tương tác Form

First things first – to create a size in our HTML document, we will need khổng lồ select the location we will be placing the form. Generally, most forms will start with:

and over with the closing tag of:

The form kích hoạt will tell this khung what to lớn look for when the submit button is pressed. In this example, we will be working with below, this is a second tệp tin that we will be creating called mail.php

The beginning line of our code that begins our size shows our kích hoạt of mail.php – & the method of POST – which will trigger the PHP script to send the e-mail when the forms are filled out, & the submit button is pressed.

Action và Method of mail.php

The last thing we will need to lớn understand before starting our size is the use of đầu vào – which will tell browsers to lớn allow an input of text type, lớn complete a field. Using this along with textarea will allow us to create our form & create a space for users to input đầu vào information that we will later use PHP khổng lồ send via email.

Each one of these areas we create on our form will be given a NAME that we will also be using on our PHP document lớn mark the information being sent.

Taking a Look at contact Form

Now let’s begin our example. We will create a very simple starting point that I will show you how to modify for your own needs. Understanding the code & how it works will help you use it better và help ensure you have less problems when placing this on a live website.

I will start with a very basic liên hệ form lớn get us started. Here is the basic HTML that we will use to lớn create our liên hệ form.

HTML form Code




Using the code above – You can insert this directly into your HTML document khổng lồ create the size itself. Later we will look at modifying this more & creating something a little more custom.

Contact form PHP: How to lớn Actually Create It?

Now, to lớn make our form work, we will need khổng lồ use a little PHP. This part is actually easier than most people think. We will be using the PHP $_POST function, and creating labels for each name that we have created in our form. This will allow us to lớn further customize the size later on as well.

Now we will create our mail.php tệp tin – This is what will generate the e-mail from the form & actually mail it:


";$subject = "Contact Form";$mailheader = "From: $email ";mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");echo "Thank You!";?>Notice our three name tags we have created. We have Name, Email, & Message. These are the three that we created in our form. This is the information that will be sent from our contact form via email.

Add More Customization To tương tác Form

Now since we have the basic idea of the tương tác form HTML, và tying it together with our PHP to lớn create a basic contact form, I will begin to go a step further and now show how you can customize this size even more to lớn fit your needs for your project.

Xem thêm: Cách Tìm Phòng Trong Liên Quân, Cách Tạo Phòng, Tìm Và Nhập Id Trong Liên Quân

I will show how to showroom a dropdown option box, và explain adding checkboxes or radio buttons for selection items lớn be chosen, và emailed from the form.

Adding Dropdown Option Boxes

To địa chỉ a dropdown box, we will need to địa chỉ cửa hàng the section within our HTML code to lớn create the area for the form, as well as showroom the proper code khổng lồ our PHP lớn recognize the đầu vào from the HTML và be able khổng lồ send it.

Here is a simple example HTML liên hệ form dropdown box:

Dropdown Box


In the example above, we have created a dropdown box with options 1 through 4. The option value will be what is actually submitted, & the Text within the will be what the user actually sees when making a selection. Remember that this will need to be inserted into your HTML document within the size fields.

Here is an example of the completed HTML contact form we have created with the dropdown box included:

HTML tương tác Form with Dropdown Box




Dropdown Box



Now we will need to change our contact form PHP lớn make sure the information from the HTML khung is rendered và submitted to the provided email address.

Let’s take a look at our modified PHP that will now have the dropdown box readable.

";$subject = "Contact Form";$mailheader = "From: $email ";mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");echo "Thank You!";?>Notice that we have added “dropdown” as a $_POST variable that will now be sent. The dropdown name itself comes from the HTML portion that is labeled as

The kích thước option lets you select how many rows will be viewable at one time. The most general setting for this is “1” but you can change it to more if you would like.

Adding Radio Buttons and Checkboxes khổng lồ a liên hệ Form

To địa chỉ Radio Buttons and Checkboxes, the same will apply as the above. We will need to địa chỉ it within our HTML code, và then modify the PHP khổng lồ take the input from the tương tác form HTML và properly send it.

Here is an example of the HTML code for adding Checkboxes:

Request Phone Call:


Full Example Using All Elements In liên hệ Form

For this example I have changed some of the names to we can create a custom liên hệ form for our completed example now that we have a basic understanding of the way it works.

Our HTML tương tác Form Code




Request Phone Call:






Website UpdateInformation ChangeInformation AdditionNew Products


And again, our PHP that will correspond with this HTML form to make it work:

Our completed PHP liên hệ Form Code

";$subject = "Contact Form";$mailheader = "From: $email ";mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");echo "Thank You!";?>

Customizing the Thank you Message on tương tác Form Success

Now for the final part of this tutorial, I will explain how lớn customize the very last line of our PHP script we have created. The basic way will just echo “Thank You” on our screen, but we need to lớn make a better way so our viewers can easily have a way khổng lồ get back to lớn another page.

This will be useful in creating a custom page redirect, or a links to bring the user khổng lồ a different area after completing the form. Remember that when working with PHP, some of the HTML will be different as khổng lồ not disrupt our PHP code.

We will need to lớn use single quotes “instead of double quotes” within this one, so we don’t end our PHP arg.

We will be adding a space after the “thank you” message, & adding a links back khổng lồ our “form.html” document (Or whatever link you wish khổng lồ create) – và also changing the màu sắc of the links using inline styles.

Let’s take a look at the modified echo command in our mail.php file:

echo "Thank You!" . " -" . " Return Home";You can play around with the example above khổng lồ create your own thank you message for your site. Inline styles are not required; I just used them for this example instead of including a stylesheet. Remember that the echo command is only seen on a successful send of the message. Otherwise, the error message is sent.

Download The contact Form Files

I am providing the tải về for the completed form for you to play with. Feel không tính phí to use it any way you wish, và customize it for your own projects. There are still many other things that can be done with PHP for your tương tác forms.

One that you might want to consider is CAPTCHA, which prevents spam email. You can also customize the other portions of the form & create your own! Have fun, & I hope that everyone has enjoyed the article & finds it useful for their own needs.

You can download the example files by clicking

Note: I have included a few styling examples using CSS in the kiểm tra download. This will allow you lớn see the forms styled và understand how to lớn style them using CSS.