6 | The Basics of PHP Form Handling Tutorial | 2023 | Learn PHP Full Course for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2024
  • The basics of PHP form validation is something that is important when learning PHP, and in this tutorial I will show you what you need to get started on the basics of PHP form handling. 🙂
    HTML Form tutorial: • 28 | HOW TO CREATE & S...
    Documentation:
    www.php.net/ma...
    www.php.net/ma...
    www.php.net/ma...
    www.w3schools....
    ➤ 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 and TH-cam Memberships to share improved and updated lesson material, and for a small fee you can access all the material either from my memberships or Patreon, depending on your preference. I have worked hard, and done my best to help you understand what I teach.
    I hope you will find it helpful :)
    Memberships: / @dani_krossing
    Patreon: / mmtuts

ความคิดเห็น • 170

  • @Dani_Krossing
    @Dani_Krossing  ปีที่แล้ว +114

    A CORRECTION TO THIS VIDEO!
    In the part where I create the exit() function, you need to make sure you place it AFTER the header() function! Otherwise the script is obviously exited before it even runs the header() function. 😂 Me dum dum me see rock smash smash hehe 😂

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +7

      @@mehdimerimi5067 The source code is linked in the description for members 🙂

    • @ShootYourBricks
      @ShootYourBricks ปีที่แล้ว +4

      I was wondering how that worked😂

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +4

      @Mehdi MERIMI Ah hehe no problem. 😊 I have trouble recognizing sarcasm, and when I also once in a while do get people who wanna "fight me about it" and are actually upset about it, I can be quick to defend my usage of memberships for my files hehe. No hard feelings. 😊

    • @cruzinsweetsntreats
      @cruzinsweetsntreats ปีที่แล้ว +1

      I was getting the auto check squiggly lines under the location redirect, unlike yourself at 23:16 for the empty value check. Once I figured that out, then saw your response here. 😁 04-16-2023 0404 PT "404 ERROR CODE" 🧐😎🤣

    • @danielbuleandra3981
      @danielbuleandra3981 11 หลายเดือนก่อน

      well reading this comment would have spared me 3-5 hours of staring into the monitor....just put a pop up comment in the video so other wont burnout trying to figure out

  • @Phil-nc5mw
    @Phil-nc5mw 6 หลายเดือนก่อน +36

    Dude the fact you made an entire course for free is amazing. Thank you so much. I wasted so much money on expensive courses for different languages not realizing I could have just been watching your videos instead.

  • @chrisjohnson9032
    @chrisjohnson9032 หลายเดือนก่อน +2

    What a blessing to find your course, THANKS!!!!!

  • @cloudagnostic
    @cloudagnostic ปีที่แล้ว +11

    Great tutorial! I started learning PHP 5 years ago and switched to javascript (nodejs). I always found php much easier and occasionally I do small projects with the language. I might make the switch back after this series!😅

  • @surangkanangkiangkitiwan4200
    @surangkanangkiangkitiwan4200 6 หลายเดือนก่อน +3

    I just wanted to say a huge thank you for offering this fantastic free course! I've tried learning programming from different places, but your way of explaining things simply is truly amazing. I'm incredibly thankful! 🙏

  • @DaAr-vp8cz
    @DaAr-vp8cz 4 หลายเดือนก่อน +2

    that is very useful! I took one PHP course before, but it never mentioned little things like this... glad I have found your course.

  • @gertjansluimer6078
    @gertjansluimer6078 ปีที่แล้ว +6

    This is better than most schools

  • @iverikhetagashvili8443
    @iverikhetagashvili8443 5 หลายเดือนก่อน +2

    Thanks for these tutorials Dani 😊😊they are super easy to understand and remember

  • @k.ashutoshbaitharu3964
    @k.ashutoshbaitharu3964 ปีที่แล้ว +4

    I like how you explain stuff in detail.

  • @pelayojhonmeltonmanio8898
    @pelayojhonmeltonmanio8898 4 หลายเดือนก่อน +2

    Thank you so much well explained

  • @nedalturas
    @nedalturas ปีที่แล้ว +2

    Been looking for some PHP tutorials as I need to re learn it, your video is very detailed and I love it.

  • @kevinerose
    @kevinerose ปีที่แล้ว +2

    Great videos! I am enjoying your format of training. I haven't programmed in 20 years and surprised to see PHP is still popular. Back then we had PHP and ASP (active server pages). Although I left programming before getting too deep into all that. My boss sent me to ASP training but we never really got very far with web development where I was working although they wanted to.

  • @mungukendejoshua3632
    @mungukendejoshua3632 ปีที่แล้ว +2

    u are the man.. much love from Uganda

  • @kibuzz3258
    @kibuzz3258 ปีที่แล้ว +2

    wonderful tutorial, i found it very usefull. Thank u a lot, keep going!!!

  • @lucaszecat
    @lucaszecat 3 หลายเดือนก่อน

    Awesome. I really love how you go 360 about everything, including security rules of thumb. I love it !

  • @moraaoo4889
    @moraaoo4889 11 หลายเดือนก่อน +2

    Everything is simple with Dani, thanks a lot ❤

  • @fissionchips223
    @fissionchips223 ปีที่แล้ว +1

    Another fantastic installment, Dani! While these are getting a little more complex, simply watching a second time makes all the difference. Thanks again for your tremendously helpful tutorials - I am having the best time learning this!

  • @remasrebas3776
    @remasrebas3776 10 หลายเดือนก่อน +1

    I'm starting to love php because of you!

  • @yomegram6721
    @yomegram6721 ปีที่แล้ว +2

    /* this champ should be getting way more likes for his efforts. Big up champ*/

  • @George83636
    @George83636 10 หลายเดือนก่อน +1

    Again great material. A talent in explaining things simply!

  • @ismiputri-5209
    @ismiputri-5209 ปีที่แล้ว +1

    Nice explanation, not only tutorial but the reason why we use code in certain way. Thank you, Dani.

  • @oluwatofaratiaro1841
    @oluwatofaratiaro1841 19 วันที่ผ่านมา +1

    funny how i understand this in my room in a few minutes than in class a whole semester
    thank you so much.

  • @techmillennium6332
    @techmillennium6332 ปีที่แล้ว +4

    Your way of teaching is great sir. But another thing I want to say sir, u looks like Elon Musk .

  • @kehindedeborah8901
    @kehindedeborah8901 ปีที่แล้ว +1

    i am glad i come across your tutorials

  • @danielolivera2618
    @danielolivera2618 10 หลายเดือนก่อน

    just found your video. thank you so much, as far as over explaining keep doing it because if you wouldn't have done it i would be lost. THANK YOU!!!

  • @BasiLand-x6o
    @BasiLand-x6o 5 หลายเดือนก่อน +1

    Thanks bro, your tutorial is simple, straight and simple ❤

  • @K.M.Lingaudhaya
    @K.M.Lingaudhaya 2 หลายเดือนก่อน

    This was a nice explanation on why to error handle using php. loved it

  • @ryyyyy2010
    @ryyyyy2010 ปีที่แล้ว +1

    Tysm bro, very useful and informative for a beginner like me.

  • @priyadharshinimuthukumar8970
    @priyadharshinimuthukumar8970 9 หลายเดือนก่อน

    thanks for giving such a good understandable concept when implementing php codes

  • @carloberioso2365
    @carloberioso2365 4 หลายเดือนก่อน +2

    Nice

  • @BeyanHaji
    @BeyanHaji หลายเดือนก่อน

    Thanks for you

  • @lordtop6847
    @lordtop6847 7 หลายเดือนก่อน +3

    Thank you for the video, but I have a problem after submitting on the initial php page on localhost with html, which causes an error in the console log on the same page: "Not allowed to load local resource: ". How did you get the final result without errors popping up?

  • @benjicanones1454
    @benjicanones1454 ปีที่แล้ว +1

    Thank you!

  • @Ithicuss
    @Ithicuss 5 หลายเดือนก่อน +1

    Very nice series so far. Enjoying it a lot. Perhaps a stylistic preference I would like to point out is that at the end of the if statement you have the header function, then an else block and another header pointing to the same address. It might be easier not to have an else statement and just move the header function below the if statement. If the user makes a post request the header function is evaluated after the if statement and if the user does not make a post request the if statement is skipped and the header function is executed. What do you think?

    • @Dani_Krossing
      @Dani_Krossing  5 หลายเดือนก่อน

      The headers are for sending the user back, with a specific message in the URL. 🙂 Either a success message, or a specific error message. So they would need to be at the end of each statement.
      But you are right, because I didn’t actually add the error messages inside the various headers, so as they were left at the end of the video, they are duplicates. So a final last step is to add the error messages. 🙂👍

  • @MaximBordyug.
    @MaximBordyug. 3 หลายเดือนก่อน +2

    Thank you. I never thought I would be taught how to create an HTML form by Elon Musk. I think this guy can impersonate him easily. Even his voice is similar :)

    • @VICTORGITAU-do5oh
      @VICTORGITAU-do5oh 3 หลายเดือนก่อน

      💯💯fr, i hadn't even realised😅

  • @yhwhgraphicstudio1161
    @yhwhgraphicstudio1161 5 หลายเดือนก่อน

    Hi.
    The user can change the required option in the frontend via inspect based on your permission in the file manager.
    Using Chmod 644 for files and 755 for folders will not allow the users change the required option via inspect.
    Awesome tutorial by the way.

  • @allestercorton9085
    @allestercorton9085 ปีที่แล้ว +1

    Wow, that's very helpful.

  • @jesuopin1612
    @jesuopin1612 ปีที่แล้ว

    Love this playlist! half an hour long videos and not very long playlist. I might have finished this playlist in less than 1 day and i can already start writting some small php scripts :D

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +1

      I'm glad you enjoy the videos 😊

  • @guillerjamesmantala7311
    @guillerjamesmantala7311 26 วันที่ผ่านมา

    Thank you sir

  • @michaelbica9294
    @michaelbica9294 ปีที่แล้ว +1

    Hi Daniel, thank you for doing this php tutorials.🍻✌

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว

      You are so welcome Michael. 🙂

  • @alynn.art.studio
    @alynn.art.studio 7 หลายเดือนก่อน +3

    14:06 ahhh! This is why some sites break your commas and ampersands!

  • @cholo2605
    @cholo2605 3 หลายเดือนก่อน

    Thanks for your content is amazing

  • @sundayemmanuel4789
    @sundayemmanuel4789 10 หลายเดือนก่อน +1

    Thanks man!

  • @makispariva1651
    @makispariva1651 10 หลายเดือนก่อน

    Thanks so much for all the deep and at the same time easy explanations!
    PHP was frustating me so much until I found your videos =)

  • @_ChildofYeshua_
    @_ChildofYeshua_ 10 หลายเดือนก่อน +1

    Send to same form =
    Action = "name of that same form"
    So if your form is on the index.php form then just call that form
    action="index.php" without including the super global. If you're gona use the super global then make sure to sanitize it i.e strip_tags, stripshlashes, trim, html entities etc...

    • @misstallschannel7983
      @misstallschannel7983 8 หลายเดือนก่อน

      Thank you so much for this comment, Yoh you helped me 😢, I have been here for hours, I was about to give up 🥹

  • @utkarshsrivastava5461
    @utkarshsrivastava5461 ปีที่แล้ว +1

    Thanx Daniel

  • @sheikharooj5762
    @sheikharooj5762 7 หลายเดือนก่อน

    Simply extraordinary.. Loved it❤

  • @mandy1784
    @mandy1784 8 หลายเดือนก่อน +1

    is that security issue still true for frontend frameworks like React or Vue? Thanks for the vid!

  • @kavinj4455
    @kavinj4455 ปีที่แล้ว

    Thank you ! this is super helpful !

  • @kerrywsmyth
    @kerrywsmyth ปีที่แล้ว

    Liked all and subscribed. Please keep them coming

  • @sonamohialdin3376
    @sonamohialdin3376 ปีที่แล้ว

    This tutorial is very helpful thank you

  • @DevinGeegh
    @DevinGeegh ปีที่แล้ว

    I love your video!!! I am curious how to throw up an error message on the index page after the exit? Also you mentioned some things after the htmlspecialchars that could be added, curious on that as well. Maybe you cover this in a later video that I haven't been through yet. Anyways... Keep up the awsome work! Thanks!

  • @Toussaintiradukunda
    @Toussaintiradukunda ปีที่แล้ว

    helpful video thank you so much🤩🤩🤩🤩🤩

  • @sirsebastian2026
    @sirsebastian2026 9 หลายเดือนก่อน

    Thank you so much!

  • @abdelrahmanabdallah6308
    @abdelrahmanabdallah6308 6 หลายเดือนก่อน

    Thanks Dani! ❤

  • @Boylagak
    @Boylagak ปีที่แล้ว

    Thank you sir Dani!❤

  • @koushikshil6037
    @koushikshil6037 6 หลายเดือนก่อน

    Thanks, bro

  • @Rooworld665
    @Rooworld665 3 หลายเดือนก่อน

    How would you view the persons information that they type after setting the user back into the home page?

  • @2684dennis
    @2684dennis 4 หลายเดือนก่อน

    hi could you please show the css sheet how you styled this form, im struggle to get every thing alignd and center, i would like to see how you did all that. thank you.

    • @Dani_Krossing
      @Dani_Krossing  4 หลายเดือนก่อน

      All my personal lesson files are available to members in the description 🙂

  • @ryanm.122
    @ryanm.122 3 หลายเดือนก่อน

    @20:20 How do you send the user back with the error message or send the user to another page with the data we just collected?

  • @IamtheActionman
    @IamtheActionman ปีที่แล้ว

    Excellent

  • @Old_school_odyssey
    @Old_school_odyssey 7 หลายเดือนก่อน

    Great video... I've gone wrong somewhere though. I only have the select option for 'Favourite pet' and no text box to type any other information in for Firstname and Lastname. Where did I go wrong?

  • @VICTORGITAU-do5oh
    @VICTORGITAU-do5oh 3 หลายเดือนก่อน

    i love your mustache btw

  • @KayleighOfSuburbia
    @KayleighOfSuburbia 4 หลายเดือนก่อน

    could you/should you use "required" on the client-side as well as the server-side validating of the empty field? or is that unnecessary?

    • @Dani_Krossing
      @Dani_Krossing  4 หลายเดือนก่อน +1

      “required” is just there to give a visual indicator. 🙂 You’ll even notice that even though it is supposed to prevent the form from being submitted, if you spam the submit button fast enough, it will still occasionally submit the form… So security wise, “required” is pointless in itself.
      So if you feel that you wanna add it in, go ahead. 🙂 It is an easy and fast way to notify a user, if they forgot to fill in an input. Just know that it is ONLY a visual indicator.

  • @marweshemello1090
    @marweshemello1090 2 หลายเดือนก่อน

    hi on my site instead of echoing user inputs i get this massage "Warning: Undefined variable $_name " did you ever get that and how do you resolve it?

  • @Izkawi33
    @Izkawi33 ปีที่แล้ว +1

    thank you Dani.
    is htmlspecialchars function used with string inputs what about if data submitted of type integer or float or boolean should I put htmlspecialchars??

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +1

      You can use htmlspecialchars() for that too yes, however we do also have more specific sanitization functions you can use for non-string data. Such as filter_var or filter_input.

  • @infinity_ahashara
    @infinity_ahashara 8 หลายเดือนก่อน +1

    you explaining very well !

  • @estudiar173
    @estudiar173 ปีที่แล้ว

    thanks

  • @krishnashrestha6040
    @krishnashrestha6040 6 หลายเดือนก่อน

    One of the best tutorial.
    And bro looks like Elon😅

  • @samaugustinejunior5679
    @samaugustinejunior5679 4 หลายเดือนก่อน

    Any time i try connecting the index.php to my formhandler.php i ger a no server found message

  • @ruudkorunka
    @ruudkorunka 9 หลายเดือนก่อน

    Good afternoon, Dani. Thanks for all your tutorials.
    Question:
    I feel that I have to choose between Javascript and PHP.
    For front-end coding and eventually also for back-end coding.
    What do you say, Javascript or PHP?
    Greetings,
    Ruud (Amsterdam, Holland)

    • @Dani_Krossing
      @Dani_Krossing  9 หลายเดือนก่อน +2

      Hi. I'm a bit confused by the question.
      You say you need to learn a front-end and a back-end language? Then it makes sense to learn both, seeing JavaScript is front-end, and PHP is back-end. 🙂
      JavaScript CAN be learned as a back-end language as well, if done so through frameworks like Node.js... But PHP is still vastly more popular as a backend choice.

    • @ruudkorunka
      @ruudkorunka 9 หลายเดือนก่อน +1

      Thank you.

  • @elfword733
    @elfword733 หลายเดือนก่อน

    This is irrelevant but you look like Elon Musk and Mr Beast combined.
    Thanks for the guides though! I just started learning about PHP so hopefully all goes well.

  • @krazy_kzir
    @krazy_kzir 8 หลายเดือนก่อน

    Hey i have a nasty error "unreachable code" when working on if statement on empty data input.

  • @RAHAT_PY
    @RAHAT_PY ปีที่แล้ว

    and thanks 😀

  • @Stoney_Eagle
    @Stoney_Eagle ปีที่แล้ว +3

    Yup, never trust the user and never trust the client.

  • @acitbambili7759
    @acitbambili7759 9 หลายเดือนก่อน

    Nice video, thanks for the efforts, God will contiue to bless you. Please, Dani i have a problem in chapter 6, about PHP Form Handling.
    This code snippet you gave:
    if(empty($_POST['name'])) {
    exit();
    header("Location: ../index.php");
    }
    I think the header line will be unreachablbe or I am missing something.
    The exit() function is exiting what, the if statement or the page?

    • @Dani_Krossing
      @Dani_Krossing  9 หลายเดือนก่อน

      Swap the exit and header functions around 🙂

  • @Elumalai1991
    @Elumalai1991 ปีที่แล้ว

    this programe form handling insert programme but not ouput what happened i dont know pls what r the reason tell me this programme second programme

  • @sakmaestro3852
    @sakmaestro3852 ปีที่แล้ว

    Great...... do u have udemy course in php?

  • @ramanmhedin1137
    @ramanmhedin1137 ปีที่แล้ว +3

    thank you for these tutorials,will you use AJAX with PHP and MySQL in the next videos?

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +2

      Later in this course we will get into MySQL yes. 🙂 AJAX I think however belong in a separate course, since it is mostly JavaScript.

  • @GoodBoy-zc3ol
    @GoodBoy-zc3ol 7 หลายเดือนก่อน

    the header() funtion doesnt seem to work when i tried it, like the code is not even there. what is wrong

    • @GoodBoy-zc3ol
      @GoodBoy-zc3ol 7 หลายเดือนก่อน

      solved it, i think i typed coma instead of dot. all i did was retype it

  • @osemekejoshua5287
    @osemekejoshua5287 หลายเดือนก่อน

    Dani, you sound like you learned this the hard way😁

  • @amiramohammed1568
    @amiramohammed1568 10 หลายเดือนก่อน

    👏🏽👏🏽👏🏽👏🏽👏🏽👏🏽👏🏽👏🏽👏🏽👏🏽👏🏽

  • @KennedyAni-l4o
    @KennedyAni-l4o ปีที่แล้ว

    More of security videos about PHP

  • @adtronadebawo7647
    @adtronadebawo7647 ปีที่แล้ว

    Great video, thanks Dani.
    But on the handler page after it loads, if you fresh it will throw an error of "undifiend array", how do we handle this?

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +1

      What is the exact error message you get? Are you sure it's not "undefined variable"? Because I don't believe we ever used an array in this video. 🙂

    • @adtronadebawo7647
      @adtronadebawo7647 ปีที่แล้ว

      @@Dani_Krossing Yes, it's undefined variables, that was a typo error.
      Thanks 🙏

  • @zairhyxezhyckatienza4789
    @zairhyxezhyckatienza4789 4 หลายเดือนก่อน

    Do you have any Udemy courses?

  • @emmanuelameyaw5686
    @emmanuelameyaw5686 ปีที่แล้ว

    Hee taught HTML and PHP together

  • @ArrifaiMuntasir
    @ArrifaiMuntasir 6 หลายเดือนก่อน

    sorry how to sumitt form in the localhost in tutorial 6

  • @jeenarshresthablm
    @jeenarshresthablm 2 หลายเดือนก่อน

    How do i create an includes file? Can anyone please help me?

  • @heinzerbrew
    @heinzerbrew 7 หลายเดือนก่อน +2

    ouch, white screen in dark mode. 🤣

  • @basiccode8889
    @basiccode8889 ปีที่แล้ว

    More videos pls

  • @kylehawks2966
    @kylehawks2966 ปีที่แล้ว +1

    10 hours just trying to get past 11min mark on you video I do no Know what I'm doing wrong went to other channell to figure out xamp, got another editor I dk

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว

      It helps if you describe the issue you are having? 🙂 Otherwise I don't have any info to help you pinpoint the issue.
      First of all, did you follow my video series from the start? If not, then it might explain why you are getting errors.

  • @brianjett1446
    @brianjett1446 11 หลายเดือนก่อน

    Can you please make a php payment form??!!!

  • @RAHAT_PY
    @RAHAT_PY ปีที่แล้ว

    Bro I don't have money; so I don't buy any update course
    Plz upload it daily.

  • @MohammedAlziko
    @MohammedAlziko 9 หลายเดือนก่อน

    😘😘😘

  • @xiaoanlao8420
    @xiaoanlao8420 ปีที่แล้ว

    Hope that you will have Udemy course for PHP

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +6

      Everything I make is free on TH-cam 🙂

  • @ArrifaiMuntasir
    @ArrifaiMuntasir 6 หลายเดือนก่อน

    sorry sir I need to explain the first of tutorial 6 I can't understand

  • @labo6813
    @labo6813 ปีที่แล้ว

    please where is the main.css code to the 6th video on forms??

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว

      In the bottom of the description, is a link to all my available lesson material. 🙂

  • @ghcybertech
    @ghcybertech ปีที่แล้ว

    i love you

  • @yuxomgaming9824
    @yuxomgaming9824 10 หลายเดือนก่อน

    U lowkey look like Mr. beast

  • @IdrissTaam
    @IdrissTaam 5 หลายเดือนก่อน

    Dude looks like Elon Musk