Object Oriented PHP #14 - Validation Class (part 3)

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • Hey gang, in this final PHP OOP tutorial we'll finish off our form validation class, test it out & then show errors / feedback to the user based on their input.
    ----------------------------------------
    🐱‍💻 🐱‍💻 Course Links:
    Course files - github.com/iam...
    🐱‍💻 🐱‍💻 Other Related Courses:
    + PHP Tutorial for Beginners - • PHP Tutorial for Begin...

КОМЕНТАРІ • 141

  • @ayoubelhaddad9909
    @ayoubelhaddad9909 4 роки тому +23

    The best tutorial OOP php

  • @maxbub7966
    @maxbub7966 2 роки тому +5

    Hey! Soo for everyone having an error in the input fields - it happens because htmlspecialchars function tries to run with $_POST data, which is null, since we havent submitted the form yet.
    Here is the code that makes a little check before sanitizing inputs:

    • @iyinoluwaogundairo1086
      @iyinoluwaogundairo1086 2 роки тому +1

      Thanks so much. I was looking for a solution to this.

    • @jakubdura8452
      @jakubdura8452 Рік тому +1

      Thanks man! u seved my project :D

    • @maxbub7966
      @maxbub7966 Рік тому

      @@jakubdura8452 You are welcome)

    • @iam.thomas
      @iam.thomas 9 місяців тому +1

      lifesaver

    • @andromilk2634
      @andromilk2634 20 днів тому

      But why did Shaun not have this problem in his video? Did the function change behaviour with time?

  • @zanyaboutit
    @zanyaboutit 4 роки тому +12

    Your lecture is so perfect that even though I am trying to learn java and understand OOP, I learn OOP concept with these PHP series by you.

  • @rahlaganemathebe9232
    @rahlaganemathebe9232 2 роки тому +2

    I watched the entire series in less than a day and it has definitely upped my game. Thanks man.

  • @oscarmartinlive
    @oscarmartinlive 4 роки тому +7

    A big, big thanks to you, Shaun. This was sooooo rich. I'm really grateful for the knowledge I've gained from you. I'm quite at beginner level, and I'm never gonna forget how much this has helped me move up. Thank you.

  • @davidegallo3879
    @davidegallo3879 Рік тому

    Minute 8:00... you don't have any idea how much time I spent on the internet trying to figure out how to preserve the input data, and in just a few seconds you solved my problem. A thousand thanks my friend.

    • @NetNinja
      @NetNinja  Рік тому +1

      Aha, glad it helped Davide! :)

  • @mayahamdan6732
    @mayahamdan6732 Рік тому +1

    Thanks very much sir, really one of the best PHP series I've watched

  • @junas2078
    @junas2078 3 роки тому +2

    from all video tutorials in UA-cam, this channel is the most easiest to understand. You deserve more views and likes.

  • @MrKyy76
    @MrKyy76 4 роки тому +6

    When entering page the first time I get
    "Notice: Undefined index: username in D:\...yadayada"
    in name field. And the same goes for email.
    Otherwise it works.
    Really great series man, much appreciated!

    • @pengdiss513
      @pengdiss513 4 роки тому +8

      try this mate
      echo htmlspecialchars($_POST['username'] ?? '')

    • @MrKyy76
      @MrKyy76 4 роки тому +1

      @@pengdiss513 Thank you. Much appreciated. This worked

    • @b4rt1j1
      @b4rt1j1 2 роки тому

      How did you solve this problem?

  • @Hackkit
    @Hackkit 4 роки тому +5

    Just Love Your Tutorials...!!! Learning Is Our Fundamental Right... And You are The "GURU"...
    ❤️ From India

  • @pvd4170
    @pvd4170 Рік тому +1

    Thank you!!! Finished your php beginner's course and just finished this one. Everything was well explained! Thank you again for all your efforts!

  • @benbrown3882
    @benbrown3882 9 місяців тому +1

    This is the best series on Php OOP I've found.

  • @Loche747
    @Loche747 4 роки тому +2

    The best series on PHP OOP ever! Thank you very much

  • @yuvalazaria
    @yuvalazaria 3 роки тому +2

    Thank you so much Shaun!! you keep sharing this very explanatory and detailed tutorials and making us better ninjas!

  • @tomaszswiatek4612
    @tomaszswiatek4612 4 роки тому +5

    Yay i like this :).It would be great to see in your implementation an object-oriented php course for a small application, e.g. a simple eCommerce store with an administrator desktop etc. But independently it was a great series - both OOP and for beginners. PHP has a lot to offer and simplifies a lot in simpler browser applications than using e.g. javascript (with continuous reference to DOM) or angular in combination with firebase. Thanks again!

  • @m7amedk
    @m7amedk 3 роки тому +2

    Completed the course.
    Very helpful & well done.
    Thank you 🙏🏼

  • @ademineshat
    @ademineshat 4 роки тому +5

    I was watching some of the videos Today again and I realized that it would be nice if there were a couple of videos including MySQL with classes a and a little project at the end the same as ninja pizzas but this time with classes!
    Thank you very much..

  • @kelvezu1585
    @kelvezu1585 5 років тому +2

    I love this series. Thanks for sharing your knowledge.

  • @kunlohith
    @kunlohith 3 роки тому +1

    Miraculous, fantastic, and inspiring way of teaching in this series and others :)

  • @mohamedbensalah7169
    @mohamedbensalah7169 4 роки тому +1

    THANK YOU FOR THIS SERIES AND EVERY VIDEO YOU POST HERE ON UA-cam.

  • @TienVo-il8jy
    @TienVo-il8jy 4 роки тому +1

    Thank you The Net Ninja so much for helping me in the very first steps in php. I wish you all of the best.

  • @userj-s2000
    @userj-s2000 Рік тому

    Alright another tut done, php oop was best interesting. I noticed that the tut and the practical example are 2 different levels, im happy you said at 2:30 that there are many ways to do this. Im also used to monolithic and modular coding style. Soon i will start making a real time chat application with pho but i really want to do oop method doing that, definitely need to practice some more

  • @jediampm
    @jediampm 4 роки тому +2

    thanks for this series for php. I read at one of comments below, that with php, you will start a series on laravel. Please before that, make a series about PDO by transform the first series of php with mysqli into pdo. After that my recomendation would be talk about autoload ( first a manual way ) and then with composer. To finalize, a video about namespace. Thanks. ;)

  • @nikolav6350
    @nikolav6350 4 роки тому +2

    Man you are amazing teacher. I have learned from you so many things in past years. This php series was great also. Can you do some videos about design patterns in PHP?

  • @tohakim29
    @tohakim29 3 роки тому

    Best Tutorial with an example

  • @ahmedeed1353
    @ahmedeed1353 3 роки тому

    the best simple oop explanation on the whole web ♥️..

  • @NedumEze
    @NedumEze Рік тому

    Amazing presentation and style and utility.
    Thank you very much Sir.

    • @NetNinja
      @NetNinja  Рік тому

      Thanks for the kind words Adolf :)

  • @excelafonime9827
    @excelafonime9827 5 місяців тому

    Best Teacher ever

  • @asraouismail4091
    @asraouismail4091 4 роки тому

    hopefully i'm a member in your channel youtube.
    the most simpliest tutorial about OOP in PHP you make it easy to absorbe and to understand thank you Shaun . my best regards

  • @ramiel2970
    @ramiel2970 4 роки тому +1

    excellent! watched PHP Tutorial for Beginners and this curse and i enjoyed it and learned so much. can you do a MVC structure for Beginners?

  • @srinivasaraoyp3640
    @srinivasaraoyp3640 Рік тому

    This demo is excellent. Thank you.

  • @yoscbd
    @yoscbd Рік тому

    Thank you for this very helpful tutorial !!!
    I wanted to get a better understanding for this OOP concept in PHP and your tutorial allowed me to do so in a very short time.
    Cheers!

  • @pepeback
    @pepeback 4 роки тому +3

    Thank you. There is a bug right at the very end. htmlspecialchars thows an error when you load the form before submitting. It fails with null values. To fix this bug use this code instead:
    value=""

    • @lofty1069
      @lofty1069 4 роки тому

      or htmlspecialchars($_POST['username'] ?? '')

  • @riverkash
    @riverkash 4 роки тому +3

    Hi Shaun, thanks for a great tutorial.
    I find that where you have passed the $_POST['username'] etc. back to the form, it is being sent back as the user typed it, should you not send it back already trim($_POST['username']), so that the user can see the data without the spaces on the front and rear of the entry?

  • @emekatimothyiloba699
    @emekatimothyiloba699 Рік тому +1

    Great

  • @safaaothman4318
    @safaaothman4318 4 роки тому

    the best tutorial oop php in youtube it's amazing

  • @shortandsimple7976
    @shortandsimple7976 3 роки тому +1

    Are you going to add videos to this playlist? Several topics are missing out... (abstract classes, interfaces, differences between them)

  • @nashwanabdullah2234
    @nashwanabdullah2234 4 роки тому +1

    I am from $iraq->kurdistan , Thanks for sharing your knowledge

  • @nicholaslim4660
    @nicholaslim4660 3 роки тому

    when reloading the page, mine outputs, undefined array key. The following is my code

  • @vincentalagao
    @vincentalagao 3 роки тому +1

    Thaaaank you shaun! great tutorial!

  • @despotjc3144
    @despotjc3144 3 роки тому

    ??? -> Warning: Undefined array key

  • @ZimcimYT
    @ZimcimYT Рік тому

    i'm just curious about something, why we arent using html attr for inputs like requiered and checking with javascript would be more convenient? of course checking with php more secured but for i'm talking just displaying errors

  • @jesserdhieb7988
    @jesserdhieb7988 3 роки тому

    thank you shaun a lot for this series

  • @erkaykarakoc9794
    @erkaykarakoc9794 2 роки тому

    You are perfect, sir!

  • @emongtindero
    @emongtindero Рік тому

    Great series

  • @NedumEze
    @NedumEze 4 роки тому

    You're among the very best.
    Wish you could do something similar with database search in a web site

  • @juantolentino4562
    @juantolentino4562 5 років тому +1

    Best Sensei ever!

  • @Greedsmith
    @Greedsmith 2 роки тому

    I would have liked to see an example with radio buttons and checkboxes.

  • @PsimanUK
    @PsimanUK 4 роки тому

    Thank you very much, Mr Ninja. This was a very helpful little tutorial.

  • @MahbubTonoy
    @MahbubTonoy 2 роки тому

    Thanks for your Awesome Tutorial Playlist!

  • @art1co
    @art1co Рік тому

    if I don't put the NULL COALESCING operator inside the htmlspecialchar BRACKETS it gives me an error, not like in the video, in which are outside the brackets, anyone else?

  • @HafizRahmanBD
    @HafizRahmanBD 6 місяців тому

    Hello Shaun, do you have any plans for updating your PHP and Laravel course on UA-cam or elsewhere? And if so then please let us know the probable time frame. 😇

  • @koustubhmuktibodh4901
    @koustubhmuktibodh4901 2 роки тому

    Very useful stuff

  • @AE-yr6mo
    @AE-yr6mo 3 роки тому +2

    Do you have any videos on Object Oriented PHP dealing with databases e.g. MYSQL?

  • @haykhayrapetyan1489
    @haykhayrapetyan1489 4 роки тому

    thanky you very much, and please add tutorials anout nuxt.js

  • @learnenglishenjoy
    @learnenglishenjoy 3 роки тому

    Really thank you, bro!!!!!

  • @jedielmwenda8377
    @jedielmwenda8377 4 роки тому

    from Nairobi Kenya ...Thenks Ninja

  • @rameshirugalbandara587
    @rameshirugalbandara587 3 роки тому

    Thank you mate!

  • @tonyhomfray
    @tonyhomfray 4 роки тому

    Great playlist! Thanks dude!

  • @mhmoudahmed7901
    @mhmoudahmed7901 2 роки тому

    fantastic

  • @shohanur_rahman_
    @shohanur_rahman_ 3 роки тому

    This php series was nice .

  • @leonvanrijswijk8409
    @leonvanrijswijk8409 5 років тому +1

    Thanks for this series. What are your plans for future series?

    • @NetNinja
      @NetNinja  5 років тому +5

      I will be doing a series on Laravel in the future. Up next though is Flutter with Firebase :)

    • @leonvanrijswijk8409
      @leonvanrijswijk8409 5 років тому +1

      @@NetNinja Laravel is great. I hope you set it up as an API with authentication. In a later series you could connect to it using a Nuxt front end.

    • @elvissam1401
      @elvissam1401 4 роки тому

      @@NetNinja I´m waiting for the Laravel course.

  • @stevewel7830
    @stevewel7830 3 роки тому

    Thank you so much from Germany!!! awesome tutorial, very easy to understand from ur explanation.

  • @detoxheavymetalssafely3944
    @detoxheavymetalssafely3944 4 роки тому +2

    i just started `Code Ninga and it's amazing!

  • @hurleywflow2227
    @hurleywflow2227 3 роки тому

    Thanks 🙏🏼

  • @noerodjim
    @noerodjim 3 роки тому

    Thank you very much for this tutorial, it is very helpful!

  • @hadisergan1
    @hadisergan1 4 роки тому

    brother thank you very much you are doing a great job.I am a big fan of yours.

  • @676005ga
    @676005ga 3 роки тому

    why do we add htmlspecialchars in an input tag instead of if(isset($_POST['submit'])) ?
    Does htmlspecialchars function evaluate that value before it was submitted?

  • @BobDoe_69
    @BobDoe_69 2 роки тому

    thanks for this

  • @ademineshat
    @ademineshat 5 років тому

    It was perfect. Thank You!

  • @bonguthandokhumalo7552
    @bonguthandokhumalo7552 2 роки тому

    Thank you so much!!!

    • @NetNinja
      @NetNinja  2 роки тому

      You're welcome! :) hope it helped

  • @shajalkumer938
    @shajalkumer938 4 роки тому +1

    after completing this series and deeply seen the codes, I am confused is this
    foreach (self::$fields as $field) {
    if (!array_key_exists($field, $this->data)) {
    trigger_error("$field is not present in data");
    return;
    }
    }
    is this really need? i can not find this usability. When actually this code will work?

    • @perianka
      @perianka 4 роки тому +1

      I don't think is needed because the key is not something that the user can modify but something that is being hard coded so :/ there's always gonna be an username and email key because we said so when adding the forms

    • @opeyemiilesanmi2059
      @opeyemiilesanmi2059 2 роки тому +1

      You'll appreciate it when there are a lot of fields and you don't want to hard code them so it's useful

  • @cliffordbamert7728
    @cliffordbamert7728 2 роки тому

    thanks for tuts

  • @RR-tj5xb
    @RR-tj5xb 4 роки тому

    you are awesome ninja

  • @ikhsanhaikal3833
    @ikhsanhaikal3833 4 роки тому +1

    Where did you learn all this things and how do you learn it, you cover alot of stuff in this channel, I wanna know your screet jutsu

  • @xvictorx2953
    @xvictorx2953 4 роки тому +1

    awesome tutorial :3

  • @vetajboy
    @vetajboy 2 місяці тому

    Thanks bro❤

    • @NetNinja
      @NetNinja  2 місяці тому

      No probs! 😊 thanks for watching

  • @IbrahimMohammad2023
    @IbrahimMohammad2023 4 роки тому

    you are amazing bro , Thank u so much

  • @kingsleyatuba
    @kingsleyatuba 3 роки тому

    Thanks a lot. I wish you could build some pho projects without much explanations. Just build so we can code along. You don't have to explain. 🙏🏾🙏🏾🙏🏾

  • @xToybitz
    @xToybitz 3 роки тому

    hi guys, I'm pretty new at PHP, I have a question, should i make a CLASS for REGISTER USER and another CLASS for VIEW USER LIST?

  • @flifluflofli
    @flifluflofli 2 роки тому

    which tutorial should I go into after that ?

  • @tonytony-fc6gq
    @tonytony-fc6gq 3 роки тому

    THANK YOU VERY MUCH!!! I cant thank you enough

  • @coolwaterdvr
    @coolwaterdvr 3 роки тому

    🙏🙏🙏🙏🙏

  • @azamoktamov3809
    @azamoktamov3809 4 роки тому +1

    Why don't you continue this course in advanced level such as making full site

  • @letsdev5261
    @letsdev5261 4 роки тому

    Thank you so much

  • @killerbidk477
    @killerbidk477 Рік тому

    Okay I rewinded the video twice to check if I made any mistake and it seems that everything is correct and I got an error at the very end when I try to echo the value of the ' email ' and ' username ' and I think I created a new error in PHP lol can I have any help please ?

  • @subhanmaulana8135
    @subhanmaulana8135 2 роки тому

    genius

  • @OnyeStephen
    @OnyeStephen Рік тому

    what if the form action was leading to a seperate page ? how would have shown the error?

    • @joker_j1268
      @joker_j1268 Рік тому +1

      You use JavaScript to prevent it, such as e.preventDefault();

  • @RaymundoGabriel
    @RaymundoGabriel 3 роки тому

    echo 'Thank you so much for this awesome content ';

  • @austinetom77
    @austinetom77 2 роки тому

    Sir how can will insert the date into database

  • @perianka
    @perianka 4 роки тому

    I get that username is not present in data because when I var_dump the data i get (array(3) { ["username"]=>) meaning that they key is "username" and not just username. When I change the $fields to [ ' "username" ', ' "email" '] I don't get these mistakes but I don't think that's a real solution, any ideas?

  • @alpeshshah6928
    @alpeshshah6928 4 роки тому

    thanks lot

  • @EsHbAnBaHaDuR
    @EsHbAnBaHaDuR 4 роки тому +1

    is this series ends?

  • @ismailhossain2059
    @ismailhossain2059 4 роки тому

    If submitted value is ok then what is process to save it into Database? Coulde show that too?

  • @joselorenzini9240
    @joselorenzini9240 2 роки тому

    thanks shaun
    i have got this error in each input:
    Notice: Undefined index: username in C:\xampp\htdocs\marble\php\thenetninja\objects\formproject\index.php on line 29
    please help me :)

  • @farhan_2467
    @farhan_2467 4 роки тому

    please make series Filepond&NodeJS

  • @beticohernandez8039
    @beticohernandez8039 4 роки тому

    Hello, will you upload more videos, will you make a project, for example a crud?
    Bye.

  • @DeepakGupta-hj2dv
    @DeepakGupta-hj2dv 5 років тому

    Please make on series React native when starting?

    • @NetNinja
      @NetNinja  5 років тому +5

      I'm currently creating that playlist now, it should be ready in about 2-3 weeks or so.

    • @DeepakGupta-hj2dv
      @DeepakGupta-hj2dv 5 років тому

      Okk thank you sir
      As soon as possible react native series upload

  • @detoxheavymetalssafely3944
    @detoxheavymetalssafely3944 4 роки тому

    wow that was embarecing

  • @tijubrains
    @tijubrains 4 роки тому

    Shaun, Laravel!!!!!! Pleaseeee🙏🙏🙏

    • @NetNinja
      @NetNinja  4 роки тому

      Just finished recording the series :D