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

Поділитися
Вставка
  • Опубліковано 17 вер 2024
  • 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 :)
    Material for this lesson: / lesson-material-42361704

КОМЕНТАРІ • 231

  • @mirovaltonen6189
    @mirovaltonen6189 6 років тому +101

    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 UA-cam actually helped me to land a job and to succeed in it. Thank you, thank you, thank you.. :)

    • @Dani_Krossing
      @Dani_Krossing  6 років тому +14

      I am glad to see that you are getting something valuable from my lessons :)

    • @mirovaltonen6189
      @mirovaltonen6189 6 років тому +2

      Totally! Of course it's not everything I need to learn, but getting a frequent dose of basics explained clearly and telling stuff while doing it the same time is something not a lot of people want to do. The amount of people typing what they are doing on Notepad and showing that during the video makes the learning so displeasing that the upkeep and/or developing your professional competence gets even harder than it is.

    • @gabov7862
      @gabov7862 6 років тому +15

      you can express how you feel when a random guy on UA-cam have helped you to get more businness by DONATING!!
      $Donate = $_PATREON "[Go to his website and donate]";
      if ( ) {
      { you have gotten benefits from this material
      } else {
      donate on his Patreon account
      }
      exit ( );

    • @gosavva1
      @gosavva1 6 років тому +1

      hhhhhhh you're right

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

      If you are earning right now, I just request you to support him on Patreon ❤. As he is not too good financially.

  • @kaustinn6817
    @kaustinn6817 6 років тому +10

    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!

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

    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

  • @Shomi_brat
    @Shomi_brat 6 років тому +4

    DUDE!You are gold!Thanks.

  • @jayantbarthwal4470
    @jayantbarthwal4470 6 років тому +4

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

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

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

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

    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!

  • @remyreijven
    @remyreijven 6 років тому +11

    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.

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

      dani is lazy, he uses if/else statements all the time...
      do yourself a favor and stop watching this tutorial, it is a waste of time believe me.

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

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

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

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

  • @rockon2278
    @rockon2278 6 років тому +2

    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!

    • @Dani_Krossing
      @Dani_Krossing  6 років тому +2

      Thank you :) I have a donate button in my channel banner and on my patreon ;)

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

    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

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

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

  • @tharunramachandran6070
    @tharunramachandran6070 6 років тому

    Instead of defining the variable inside the url and and accessing it in the signup.inc.php we could define the session variables and access the variables in the signup.inc.php. After inserting it into the database you could destroy the session right? correct me if I am wrong. The rest of the video where you prohibit deleting all the entered data and showing error only in the wrong fields is awesome! Thanks man.

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

    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 'You did not fill in all fields';
    }
    or do it like;
    $message = $_GET['signup'];
    if ($message === 'empty') {
    echo 'You did not fill in all fields';
    }
    ...and so on...

  • @hiteshchoudhary3412
    @hiteshchoudhary3412 6 років тому +8

    Hey mm, please try to make laravel for beginners after this????

  • @aleksandarkrasic8324
    @aleksandarkrasic8324 6 років тому +2

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

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

      I agree but I guess it's for the sake of the tutorial

  • @javierr5845
    @javierr5845 6 років тому

    very helpfull video !! your tuts are aweosome,but i have one Q that i can't solve from the last 3 months, i'm working with bootstrap and when i need to display an error message for example: The user account doesn't exist its any way to display that error box over another element in the page, for example over a jumbotron (bootstrap component), so in that way i dont push the other element down in the page, thanks in advance and please keep doing this tutorials there are very helpful

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

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

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

    Enjoyed this episode also! Thank you very much!

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

    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

  • @Instructors-tube
    @Instructors-tube 2 роки тому

    Really you are teaching nice.

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

    Thanks for the amazing content as always. I have a question. Returning the first name, last name, and username in the URL, doesn't that pose a security risk? I've always heard that you don't use get when submitting a form.

  • @legendslein
    @legendslein 6 років тому +1

    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?

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

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

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

    nice video
    but it's better to use sessions for storing data such as error messages or fields values

  • @techexpert2010
    @techexpert2010 6 років тому

    Thank-you for the lessons. If possible make a tutorial that allows users to create pages like on Facebook. Looking forward to hearing from you soon.

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

    Hey Daniel I went into problem after writing this code, so straight to the point, after writing information in my input and submitting I''m geting into ' Object not found error ', it's seems that my program somehow can't read the signup=empty etc. any suggestions? in either way I can't get back into my front page, but my URL error message works fine, any suggestion bro?

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

      i am also having the same problem. ? have you solved it yet ?

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

      Noup :(

  • @yudhisthirsingh8401
    @yudhisthirsingh8401 6 років тому

    Please make a course on Laravel. You are amazing

  • @AS-kw1ob
    @AS-kw1ob 4 роки тому +3

    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

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

    Such a wonderful explanation!

  • @job4810
    @job4810 6 років тому

    Hey brother, are you re-uploading the previous videos or these are newly updated ones? I followed up all your previous lessons and they were awesome. Thanks for the knowledge you share with us by the way!

    • @Dani_Krossing
      @Dani_Krossing  6 років тому +1

      Yes this tutorial was the final re-upload for the PHP course :)

  • @aymanmedhat9636
    @aymanmedhat9636 6 років тому

    Awesome tutorial bro!! i really liked it! thanks so much!

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

    Hi, I really appreciate your tutorial series, I like it!
    I can see when working with PHP and passing parameters people always work with URL. So they add parameters directly to the URL. How can I pass parameters without using the URL? Because there are some parameters that I do not want to expose because of the potential vulnerabilities.

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

      Use POST instead of GET in the attribute method of form

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

    just wanna ask, if you're going to refresh the page, does the error message will disappear?

  • @aquibb8140
    @aquibb8140 6 років тому +1

    Hey Dude,
    Which Editor you are using??

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

    truly helpful thank you so much!!

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

    Daniel, you are amazing.

  • @mykevin1122
    @mykevin1122 6 років тому +1

    You need to make sure that you include quotes followed by period in the header method for each variable
    header('Location: ../index.php?signup=email&first='.$first.'&last='.$last.'&uid='.$uid.'');

    • @Dani_Krossing
      @Dani_Krossing  6 років тому +1

      Nope :) Today it is optional whether or not to concatenate or directly insert variables into strings. I think they changed this sometime around PHP v5. But I will say that I usually prefer concatenating as well :)

    • @ushagovind1867
      @ushagovind1867 6 років тому

      mmtuts /

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

    How to find this -- *license your cms from "General Settings > License".  * it is hidden in view source and orginal file but visible in inspect and alert box also showing

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

    Interesting videos, just curious why you wouldn't just add the code value="" and so on to each form input, that way if the data is passed it will fill the form, if there is no data, the form will remain empty and use the placeholder text? Seems like a lot of extra lines of code that isn't needed?

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

    great explanation!!

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

    Hi Dani, thanks ever so much for your courses... so easy to understand. I have a question though...
    How do I return radio button values back into the form as my radio buttons already have values assigned? eg
    q1.blah blah blah?
    Yes
    No
    N/A

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

    Thanks man

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

    Thanks alot mmtuts :) ,I will support you

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

    Dude this is really helpful thanks for making this❤️❤️

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

    thanks so much.

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

    Wow amazing

  • @andreaferrari9222
    @andreaferrari9222 6 років тому

    Hi Daniel!
    Congratulations for this series, is awesome!
    Where i can find the css do u use in this video?

    • @Dani_Krossing
      @Dani_Krossing  6 років тому

      Thank you :) I beleieve there is a link to the files on my Patreon in the video description.

    • @andreaferrari9222
      @andreaferrari9222 6 років тому

      Ok!
      will you do a series on laravel?

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

    Wow .. Thank You..

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

    If at first it doesn't work... try... try... try again!
    Yeah... I got it now - the whole thing!

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

    hey guys, good day! I'm stuck for almost 3 hours in the latter part of the video where the other input value will still remain if one of them got errors.
    and this is what I had found;
    this my first code:
    header('location: ../index.php?signup=email&first=$first&last=$last&uid=$uid');
    then I tried this code and this worked:
    header("location: ../index.php?signup=email&first=$first&last=$last&uid=$uid");
    Look at the quotation mark, I'd thought it is ok to use either " " or ' ' just to make you don't have any quotation mark inside your quotation mark. I hope you get what I mean.

  • @jackywong941
    @jackywong941 6 років тому +1

    to avoid people type html code in username or password or....., u should use htmlentities($var)

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

    Hi Daniel! Very nice way to keep the input values after submission, However, is there a way to hide the values in the URL or a workaround to keep the values without using $_GET? thank you

    • @dav.R7
      @dav.R7 Рік тому

      @Hayat Zee You have to use Ajax

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

      @@dav.R7 Thanks for your reply, I eventualy used the $_SESSION variables instead and kept the URL clean.

  • @elliotowasp4077
    @elliotowasp4077 6 років тому

    Gracias!!!!! Muchas gracias!!!!!

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

    Thanks.. I think there a small issue witch is when user refreshing the page the parameters will stay in url and the message will showing!!

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

    Hi Daniel, first of all big thanks for these great tutorials.
    I have a question. If the user fill in completely and correctly the form and submit it.. In the success message how can I customised it to be like this "Welcome Daniel, You are now registered"
    Daniel is the first name.
    I tried this code and it doesn't work..
    echo "'Welcome '. $first. ', You are now registered'
    It says Undefined $first.
    What is the correct way for this. Thanks

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

    Hi Daniel! You have a variable in your script called $_SERVER. What is this variable equal to?

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

    Hi Daniel, I have encounter a problem when using method of getting the values from the url.
    First, when I entered some illegal name eg. %^, and then correct info for other fields, I would get an error message as expected, with the corrected fields filled in using the $_GET method from the url.
    But then when I resubmit the form with corrected details, eg. dave, with all other fields filled in correctly using the GET method from the url, I got the empty error message.
    What's happening?

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

    Well I don't know how, but the time you tested your code at 4:34 it didn't work for me, it just gets redirected to /includes/signup.inc.php..
    Any ideas what could've happen?

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

    Thanks Daniel for the video, one question though: if the user entered invalid email and a username already in use. The signup form will throw back the error as invalid email only as it will exit with the email error in the URL before running the username handler on the signup.inc.php and it will return the username into the signup form to the user. How can we let the signup.inc.php file check the user first and last name, email and username before returning the error and how to have a combination of errors before directing the user to the signup.php?

    • @Jack-vv7zb
      @Jack-vv7zb 4 роки тому

      With the way that's shown in the video we cannot. But instead what we can do is create an array, and then for each error we encounter add a string of text to that array. Then at the end of the script we can check if the array is empty (it will be empty if there are no errors) and can continue to sign the user up. We can then also display this array on the sign up page, and it will output all of errors. I'd recommend reading through the code shown on this page to get a better understanding. codewithawa.com/posts/complete-user-registration-system-using-php-and-mysql-database

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

    Hi Dani. at 14:17 you said that the line 38 isset will get the data from url. how does the "if(!isset([$_GET['signup'])){" will get a data from URL? or is it automatic when you coded it like that? i check the other lines and i didnt saw you declare a "signup" variable so im confuse where the "signup" variable came from.

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

      $_GET['signup'] grabs the data from the submit button from the previous page.
      The one that looked like this in the HTML form:
      Signup
      It is the "name" attribute we grab in the URL on the next page. 🙂
      I think the reason you might be confused, is because the doesn't actually have a value. So technically, when we send it to the next page it will have no value in it, but that doesn't mean it doesn't get send anyways. It will just be "blank".
      But you have to remember, that we don't use it on the next page "because it has data in it"... But because we "just need it to exist" on the next page, to check if the form was submitted properly.
      So by inserting it into the !isset(), we check if the submitted button does not exist, in which case we send them away from our script since it shouldn't get run.
      It only exists so that we can check if the user got to our script legitimately. 🙂

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

      @@Dani_Krossing Thanks! really clarified my confusion on that part!
      bit off topic: i wonder if you will or already have a video how to upload this file to a website online(ex: Github Page)? like uploading the HTML, PHP, CSS Javascript etc to website and make it online.
      so far from what i watched what we are doing is Local only, i wonder if it is possible to upload and make the entire file work as an actual website, then all inputs will be sent to your local/database? (like the front end/website is online but all inputs will be sent to your device/pc/laptop locally...instead of Cloud/online server)
      i could be asking a big question that seems wrong, haven't experience a working online website yet...

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

    we use else if in this example as long as I know from other languages if we use else if that means the other ones are not true so if one of them is true then system will not read others, so it's not like that in php?

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

    it went from 0 to a hundred real quick in the series

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

    Do you have something like this but if you entered correctly, and sign up, the data will be save in another php file

  • @pianoLee-sx9dx
    @pianoLee-sx9dx 5 років тому

    Is there any other part of the page where you can display error handlers? I get an internal error when doing this on my other pages...

  • @hamdimadi5477
    @hamdimadi5477 6 років тому

    My Brother i want to ask about when i create marksheet from the user i have one issue. In subject box i can write 0 to 100 number means restriction on text boxes.

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

    I'm confused on the reasoning for adding the concatenation operators in addition to the single quotes around the php variables when inserting the data pulled from the GET method into the form field.

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

    Does the data still save into the database even though the data that the user was type is invalid? Coz i noticed in my current project that incorrect data still get save in my database? How can i avoid it?

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

    hello sir, it seems you have used so many if else condition which is very much confusing for me....in context of opening and closing of brackets.
    for my own ease of understanding may i use if.... elseif ?

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

    Hi I followed along with the video and have all of my error messages working properly except it still enters the data into the database although the error message pops up. For example, if i leave all of the fields in the form black and click submit, the error message pops up but I get a blank entry. Or if i purposely add a username not meeting the preg_match specifications, the data is still entered into the database. How can I fix this? Thanks

  • @The4tticuz
    @The4tticuz 6 років тому

    Since you're accessing your DB just if "submit" button was clicked, would it be better to die() and close() the connection when error was thrown?

    • @Dani_Krossing
      @Dani_Krossing  6 років тому

      die() does the exact same as exit(), except using exit() we can include an error message :) However when it comes to connecting to a database using mysqli we technically don't need to close the connection again because it is done automatically. Therefore the connection should only be manually closed to improve performance in regards to PHP and MySQL.

    • @The4tticuz
      @The4tticuz 6 років тому

      @@Dani_Krossing thanks for that quick reply!

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

    why you dont use else if for checking errors

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

    how do we do this for empty radio button values?

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

    I made a errorlog session variable to store error message and echoed it in a div in main page

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

    AWESOME!

  • @RakeshKumar-gh3ys
    @RakeshKumar-gh3ys 6 років тому

    I have a form in bootstrap modals. If I hit submit button on that form and want to return back a error message "email already exist" on back to same modal page. I will try your method, it works but error message not display on modal page, and whole page stuck. can u help on them if supply the whole code.

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

    Same issue in the second part. what's going wrong ??
    [I just downloaded your code (php42, video 42; How to display error....) and tested it on my localhost (Xampp). The first part, doesn't work on my Xampp. The form is working but always ends up with "index.php?signup=char" altough I used only an invalid Email. So it should say: "index.php?signup=email" !??]

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

    I just downloaded your code (php42, video 42; How to display error....) and tested it on my localhost (Xampp). The first part, doesn't work on my Xampp. The form is working but always ends up with "index.php?signup=char" altough I used only an invalid Email. So it should say: "index.php?signup=email" !??

  • @pianoLee-sx9dx
    @pianoLee-sx9dx 6 років тому

    Do you have a lesson on timestamp?

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

    can we just use HTML required for this or this is the best way?

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

      NEVER use front end like HTML, CSS, or JavaScript for security. 🙂 You can easily remove the required attribute using the browsers build in developer tool. Btw I have a new 2023 PHP course on my channel, which is much better than this older one, and it explains this as well.

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

    One problem is that the value doesnt save if using a textarea tag, maybe this is because value attribute works different with this tag? Anyone know how to fix...

  • @vishalsrivastava3656
    @vishalsrivastava3656 6 років тому

    I think PHP should have a function or an dedicated file for login system, because it is very tedious job to write such a long code for small functionality.
    Error should be displayed using Java script at the time of entring the data (if some wrong data is inputed)

    • @ramonteuling672
      @ramonteuling672 6 років тому

      javascript can be bypassed since its front-end

    • @vishalsrivastava3656
      @vishalsrivastava3656 6 років тому

      @@ramonteuling672 thats true but some of the validation should be applied with javascript or php would slow down the server

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

    This is overly complicated. You can just do if(isset($_GET[‘signup=empty’])) {echo «Signup is empty»;}

    • @MegaDanne35
      @MegaDanne35 6 років тому

      were do you think this should be placed?

    • @zodismegalame
      @zodismegalame 6 років тому +1

      tried doing this but got a syntax error due to an unnexpected else, any help?

    • @brantedselnemiada4956
      @brantedselnemiada4956 6 років тому +1

      loops you might forgot to close your loop tag

  • @yuuz3151
    @yuuz3151 6 років тому

    Is it possible to move the error message? Like put each error under the field where it belongs to

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

    actually keeping form values doesn't work since the form submits to another page which refreshes the page anyway. unless you click back to start from where you left(which the client aint gonna do ) otherwise you're not gonna get what you want most especially when you've validated and secured you're inputs using mysqli.
    I have spent 4hrs searching online for this cuz my inputs kept on returning empty inputs even when the error was displayed.

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

    Hi Daniel, i know am probably commenting on these very late and i hope i get a reply to fix my problem... Whenever i click on the submit button while the forms are empty and even with the rest of the error codes, the error message doesn't show but instead show Object not found like these
    Object not found!
    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
    If you think this is a server error, please contact the webmaster.
    Error 404
    localhost
    Apache/2.4.35 (Win32) OpenSSL/1.1.0i PHP/7.2.11
    My paths files are correct but i can't seems to figure out what the problem is exactly... Thanks, pls help me out cause i started web dev recently

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

      i might be late replying but inside signup.inc.php file you may have left an space between Location and :
      for eg" Location : url?....." whereas it should be "Location: url?... "

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

    If anyone has the problem that you get the value in the url but the message doesn't show up, is because you have to style the classes in your .css file, for example:
    .success {
    height: 50px;
    color: green;
    }
    .error {
    height: 50px;
    color: red;
    }

  • @himanshukanojiya3233
    @himanshukanojiya3233 6 років тому

    hello sir nice video , but i have one question :- after signup and entered invalid email i dont want (Fname ,Lname,username) show in URL. so for this what i have to do?

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

    I don't know why, but in index.php this code did not work:
    "if (strpos($fullUrl, "signup=empty"==true))"
    Then I tried the following code, which worked:
    "if (strpos($fullUrl, "signup=empty"))"
    Can anyone explain why that might have happened?

  • @mcstevendela1947
    @mcstevendela1947 6 років тому

    hey mmtuts ,why this code doesn't running on me $first = $_GET['first']; it enters on the if statement but when i'm passing the value on variable it doesn't i try to echo it but no output Hope you can help me :)

  • @lusingarib
    @lusingarib 6 років тому

    Isn't it much more efficient checking the blank fields and the e-mail using java script since no data from server is required???

    • @Dani_Krossing
      @Dani_Krossing  6 років тому +1

      That is also a possibility, however all front-end languages such as HTML, CSS and JavaScript can be changed using the browsers build-in tool. So the users can just bypass JavaScript easily. PHP is serverside which means it can't be changed in the build-in tool.

    • @lusingarib
      @lusingarib 6 років тому

      Thank you

  • @Omar-ef3hj
    @Omar-ef3hj 5 років тому

    on the second method is it possible to change the "if" statement to switch case but the same process.? example is
    if(!$_GET['signup']){
    exit();
    }else{
    $sCode = $_GET['signup'];
    switch($sCode){
    case 'invalid char:
    echo"invalid character";
    break;
    case 'invalid email:
    echo"invalid email";
    break;
    default;
    echo 'asdasd";
    break;

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

    Why not use the Switch case in the second method?

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

    Thanks a lot +1 sub

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

    Sir Sweet alert message show wrong page....e.g when i delete record. Record deleted but no message show when i click edit button alert show record deleted...how to solve it..

  • @whynottoday833
    @whynottoday833 6 років тому

    Hi Daniel,
    Everything in my form is running correctly, but I the paragraph which was showing error and success in the first method is not showing the 2nd method, but all the other things are running absolutely fine. Please help me to identify this problem.

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

    Hi.. i have a problem
    i followed everything, but whenever there's an error and i try to send all data from other input fields, the whole thing kinda collapses.
    some input fields appear where they should NOT appear (address appearing after password.. WTF?)
    labels disappearing...
    div spaces disappearing...
    and general fuckery... please help

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

      you just need to change name of inputs
      i also faced this problem because of that

  • @pianoLee-sx9dx
    @pianoLee-sx9dx 6 років тому

    I have corrected my signup2 file but now I am getting the following errors:
    Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:\xampp\htdocs\phplessons\index6.php on line 26
    Also, at line 33, you have elseif for success but shouldn't that just be a normal else? because it is the last thing to check?

    • @vishalsrivastava3656
      @vishalsrivastava3656 6 років тому

      you probably had missed to add ; (semi colon) in any statement just above the line where you are getting an error on line no. or a starting or closing { or }

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

    nice