42: How to Display Error Messages Using PHP | PHP Tutorial | Learn PHP Programming

preview_player
Показать описание
How to Display Error Messages Using PHP | PHP Tutorial | Learn PHP Programming. In this PHP tutorial, you will learn how to show the user an error message using PHP, after they submit a form on your website. This is done by sending data back to the form using PHP validation.

We will also cover how to keep the data in the form inputs, if the user is sent back with an error, so they don't need to re-type everything.

➤ GET ACCESS TO MY LESSON MATERIAL HERE!

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 :)

Рекомендации по теме
Комментарии
Автор

Hi Daniel! I started learning PHP out of scratch and found your videos. I actually landed a job few months ago where PHP was essential, but I didn't have that much of knowledge about it yet. I've been doing other stuff meanwhile I've been learning PHP on my own through your videos.

Long story short: All these videos have helped me to get more and more responsibility and harder tasks from our clients.

Thank you for helping me succeed at my job and to make a living and actually do something that is really interesting and always challenging. I don't know how to express how it feels when a random guy on YouTube actually helped me to land a job and to succeed in it. Thank you, thank you, thank you.. :)

mirovaltonen
Автор

A awesome php tutorial would be a automated email, like when you sign up for something it says, "sending verification code to email" or something, that would be really helpful!

kaustinn
Автор

thank you for doing this series again it's not that you did it terribly here its just you explained the html/css series way better

antonytome
Автор

hey buddy, you are one of the best online teacher, thanks for these tutorials.

jayantbarthwal
Автор

Daniel is gifted to explain. Complicated staff and makes them easy. Thanks alot man you de best

georgemugala
Автор

Truly speaking...Daniel you tought me PHP from scratch

theparten
Автор

Hey, thanks for awesome tutorials. I've been watching the series and I'm learning fast. You should set up a donate button. you could earn some tips for sharing your knowledge. Thanks again. You Rock!

rockon
Автор

Thanks for everything dani....You are one of the I get frustrated when learning php, sometimes I don't understand anything

skylark_doyle
Автор

Hi, Daniel! Thank you for the lession! There is a nuance though. If you leave any of the fields empty (say, password) and click submit, it still erases all fields. Not the best UX. Could you kindly advise? Thanks!

tomclain
Автор

I don't get the point of using exit() within the if/elseif-statements. I assume that PHP already ignores irrelevant outcomes by itself and hence optimizing the performance.

However, I would use a switch-statement for the $signupCheck validation, to avoid a lot of elseifs. In that case, using exit() would make more sense to me.

remyreijven
Автор

Thanks, your tutorials have been really helpful. Please drop one for shopping cart 🙏

iyaweosahon
Автор

رائع كان هذا مفيدا حقا
wow it was so useful
your fan from egy ARABIC FAN <3

badrmahfiuz
Автор

DANI!! you are just amazing... You have literally inspired me. I wish you happiness, success and peace of mind. :)

sadiqahmed
Автор

When the page is loaded you can actually get the URL parameters by simply using $_GET[param]. Then you can just do it like:

if ($_GET['signup'] === 'empty') {
echo '<p class="error">You did not fill in all fields</p>';
}

or do it like;

$message = $_GET['signup'];

if ($message === 'empty') {
echo '<p class="error">You did not fill in all fields</p>';
}
...and so on...

CromwellBayon
Автор

did not work for me, I'm getting an redirect loop, cause of the header location redirect to the same page, idk how to fix that

AS-kwob
Автор

Thanks for this tutorial bro, been having a hard time how to send error message back to previous page without having the log_error messages of sql showing up, thumbs up for ya

justinabuela
Автор

Enjoyed this episode also! Thank you very much!

yongjung
Автор

Hi Daniel, I just wanted to say that your videos are so far the best I've ever seen on PHP! I've just started working with PHP and your videos helped me a lot, thanks :)) I have just one question and if you could answer I'll be grateful forever. Why the do you need to write --> value= " ' . $uid . '" ? I thought you had to use the dots only when you need to concatenate

mig
Автор

I suppose we could write a switch statment with cases, and also breaks after every case instead of exit() ? :)

aleksandarkrasic
Автор

when returning the values to the form isn't it easier to echo into the inputs value tag instead of echoing a whole new input line?

legendslein