58: How to Create A PHP Contact Form | PHP Tutorial | Learn PHP Programming | HTML Contact Form

How to create a PHP contact form | PHP tutorial | Learn PHP programming | HTML contact form. In this PHP tutorial video you will learn how to create a PHP contact form, which you can use on your website to let people to send you e-mails.


First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful :)

Material for this lesson: https://www.patreon.com/posts/php-58-download-15902019


akshay neema says:

first :)

Solitide says:

What can I do if I send a “Confirm your registration” mail to a gmail account? will it just block the mail?

James Barratt says:

Damn real easy. I searched the net for months on this topic. I only found yesterday I could get the php and form together on one page and it sent emails, only if I dropped in a bootstrap 3 form styling the send message then appeared on a separate page regardless. This is defo for tomorrows testing. Awesome. Best tutor on the net. If you are looking for work on a project Daniel, email me at jai.barrett@me.com. Geolocation in a site, and texting to mobiles.

Raj says:

Nice, Man!!

Yasir Ayad says:

Thanks for uploading this tutorial. ♥
how can I upload the image with contact form And sending to the Email ?

Adrian Roach says:

I’m actually kind of depressed that you aren’t getting as many views as you deserve. You’ve been through some things and all, but damn people should respect that. Anyway, great videos keep up the good work! One of the best tutorial channels I’ve subscribed to.

Pak Tube says:

thank you sir , i waiting for this .

hamad habarneh says:

Well done course and very clear language and writing.
Thank you and good luck.

Oston Code Cypher says:

Awesome Dude. I am really feeling sorry for the views you are getting. You deserve million views and subscribers. Thanks for making this video.

James Barratt says:

Anyone want this form with tel box and also a send message appearing after clicking send button. If so this is the whole index.php adapted from this tutorial. Hope it helps.

< !DOCTYPE html>

Contact Form

< ?php if (isset($_POST['submit'])) { $name = $_POST['name']; $subject = $_POST['subject']; $mailFrom = $_POST['mail']; $message = $_POST['message']; $phone = $_POST['phone']; $success = ""; $mailTo = "jai.barrett@me.com"; $headers = "From: ".$mailFrom; $txt = "You have received an e-mail from ".$name.".nn".$phone.".nn".$message; mail($mailTo, $subject, $txt, $headers); $success = "This message sent"; } ?>


” method=”POST”>

< ?php echo $success ?>

dhiraj sathe says:

pleace sir How to make (Sticky Navigation bar resposive video create )

James Barratt says:

I wouldn’t let the. Amount of views unsettle you. I have my own mechanic training videos and even when you have thousands upon thousands of views, youtube pay you nothing. You know this anyway. I make more money from doing videos where I say I am selling a video on a topic. People email me and then I send a paypal invoice to them. Once paid for £6.50 I send the link across. Something you should consider. I would buy your video’s.

Sujon Pramanik says:

Sir Your Tutorial is very good. I learned a lot from you , thanks Man

Via Nashwan says:

gooooooooodddddd , man , goooooooddddddd

Antonis Mesiris says:

Thank you sir!

Hossen Muhammad says:

Please make tutorial for download link


I learned a lot from you , thanks Man

Loz Turner says:

how do you make it secure and stop hacking like injection and others

WantToBePals says:

i like all the vids c:

harish jangid says:

Hey you are amazing can you make video on how to make dashboard for user and how to put specific data inside also how to crate admin panel
Thank you
With love

Sara Alba says:

AMAZING EASY AND TO THE POINT. Thanks a lot for this tutorial! Got one question tho. is there a way to have a confirmation page or lightbox or an alert kind of thing once the email is sent?

Jonas Albrecht says:

Hi, First I wanna say that your videos are great.It’s easy to understand you and it make fun for me to learn with your videos.
But I would like to add something to the types of input: the ability to select different input types to the forms simplifies the user-friendliness, especially on mobile devices. For example the email field would change the keyboard on the smartphone and the @ would be displayed on it. With HTML5 many new input types has been added.
(Here is the reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Form_%3Cinput%3E_types )

I’m definitely looking forward to more videos :)

Red Destroy says:

Thank you

J P says:

Hi man, would you be able to help me?
I’ve watched how to create a form with php, but would you be able to tell me how to create a form on the same page. As a popup I mean. For example, if I click “sign up”, it stays on the same page but creates a popup form which can be filled out and then sent.

Nurisha Hania Kamarudin says:

Hello,I need your help. Why I change the email to my email which is gmail it not work ??? so how to make it work ??

EwaThijsNL PK says:

I cannot receive an email to my email adress! so where goes it wrong?

Saiesh Volvaiker says:

Great buddy

Frank Terrel says:

Hi ALL, So if I have a website with 3 nav files : Home.html, Service.html and Contact.html. For my Contact form to work, I have to change it .PHP extension or this means that ALL files have to .PHP extension too? Is it possible that only the contact nav be PHP and the rest remain as HTML ? any comment will help. thanks

Marshal Hembram says:

How can I add alert box instead of header function?

AlphaGamer HD says:

@mmtuts I am working on a project do you have anything I can contact you at for some help?

DonaldTrumpFaggot says:

If I’m correct you can also set the type of the input to email, phone, etc. So it has a bit more security rather than someone putting in gibberish in the email input box.

jarogo says:

what about sanitizing input data?

DLiberator78 says:

Thanks for uploading this tutorial. Very useful. When designing forms and multiple webpages; is it best to use PHP when factoring? Usually done by putting the webpage header and footer in separate files as I don’t believe this is possible with standard html webpages.

ElRadioDJ913 says:

The content that you always upload made me feel more confident in programming even though I love film and video games. Keep it up man!

Nurisha Hania Kamarudin says:

Hello. I want to ask you , how to run this program using wamp server ? I don’t have xampp server . I have tried run this program, it working but I didn’t receive any email.

Nurisha Hania Kamarudin says:

Very good tutorial . Useful and helpful . I have a question , this program will function or not if I didn’t upload ? I mean like html that still can run without upload or not have internet connection . Please help me .

fsasfsas1 says:

can you please give a link to your error-handling tutorial? I can not find it…. thanks, Anjo

Public Tutorials says:

Hey, I love how you actually get straight to the point and actually make videos with useful real life examples and not just speak theory or demonstrate cases that have no real life abutment! Your videos saved me from failing one of my uni courses. Thanks alot! If I were to be pointy about your tutorials I’d say that I wished you started off with showing the result (So that we can skip the video if it wasn’t what we were looking for). But keep up the amazing content!

DrHanna says:

Welcome back please i need a tutorial about integrating payment proccessors like paypal please :)

Marcos C. Santos says:

Do you have plans to make a “tag system” (Like in stack overflow)?

Habeebi Mohamed says:

can you please do twig, symfony, api tuts?

Real World says:

Which playlist are these php tuts under cant find them

Habeebi Mohamed says:

I’m so impressed by your worthy free php tuts. it’s uniquest tuts ever. thanks dude.

Antonis Mesiris says:

Is it possible in later videos, to explain how we should make dynamic websites? I ve learned a lot about respnsive static pages but i a bit confused about how to take apart the site to be functional for php editting and accessing it from a simple cms.. thank you again sir!

Toni Zlatanoski says:

hey man i wrote to you on fb can you please write back cos i need your help.

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours