Is it wrong to use htmlspecialchars with input numbers instead of filter_input ?
@Dani_Krossing Жыл бұрын
No it is not. 🙂 However it is important to know the difference between them, since they serve different purposes. I'll briefly explain them bellow. 😊 For the sake of my explanation, let's pretend I somehow managed to type
@amirgohary Жыл бұрын
@@Dani_Krossing Thanks for replying Do you have courses at Udemy, I tried to reach you but did not find. I would suggest if you create multi tenant for core php, "not laravel" It will be very helpful for most people because there is no available course for multi tenant core php
@Dani_Krossing Жыл бұрын
@@amirgohary Everything I create is freely available on KZbin. 🙂 One of my main goals when I started this channel, was to make sure that people who couldn't afford college, had a place to learn.
@yousifky Жыл бұрын
@@Dani_Krossing that's why you are the best teacher on KZbin ❤
@tarkmenguc8031 Жыл бұрын
Thank you for this explanation! It helped a lot!@@Dani_Krossing
@FirdavsiGameDev8 ай бұрын
I'm new to PHP and building this calculator brought so much joy to learning. I wish you had more of these mini projects within your courses.
@EverydayJason Жыл бұрын
whoa thought you were done with PHP. Glad to see you are still building tutorials for it. I am a full time PHP developer now and I started learning to code from videos of yours from ages ago. Well before ChatGPT, tuts like yours were one of the best ways to learn. I still use your file upload script that I built from watching your tutorial back a million years ago
@saidadan9982Ай бұрын
I would like to take this opportunity to thank you for the great work you are doing, you explain everything in details until everyone understands. In university lectures don’t even teach the way you are,simplifying all the complex concepts. You have given me hope to continue learning programming. Stay blessed 🙏
@Commenter3399 ай бұрын
Thanks, Dani! Your videos are great. They make learning so much easier, because I watch not just because "I have to learn", but because they're fun to watch and easy to understand. And that's quite an achievment, if you ask me!
@lawrencemichael55717 күн бұрын
Dani Krossing is the man! Been a fan since MMTUTS days!
@constantine9074 Жыл бұрын
Im planning to learn php soon.. i know which channel im gonna watch 😊 thank you for your time
@rkendtoend Жыл бұрын
Back to basics 😍. Really enjoy yours videos. Thanks a lot.
@AgenceWebSigma8 ай бұрын
Good tutorial as usual from a nice teacher!
@mahnooraltaf8525 Жыл бұрын
I liked your way of teaching. Please continue with it.If you have read my comment, then reply.
@The-Ma5ter10 ай бұрын
Thank you so much sir, you are an amazing teacher best of the best
@mayureshchavan3382 Жыл бұрын
Keep it up bro UR doing Awesome Work 👍
@falkOnAir3 ай бұрын
Dear Dani, it is a pleasure to watch your tutorials. Thanks for your work! You are wondering why it is possible to type in some letters in the numb-input-field and the reason for that is: "The number e (Euler's number) is a mathematical constant approximately equal to 2.71828 that can be characterized in many ways."(src="wiki")
@lahcenaouina Жыл бұрын
THANKKKKK YOU
@sleepysapphire2349 Жыл бұрын
Learning PHP for the server side just feels right, especially with your way of explaining things. I've been scratching my head trying to learn Flask(python). It feels weird especially because of OOP.
@michaelsunday6860Ай бұрын
You are a Genius!!!
@GerritforBazeja Жыл бұрын
It's nice so much time you take to explaine why en what you're doing
@ramen_012 Жыл бұрын
18:47 thanks for the tip
@mortwain1809 Жыл бұрын
It was a very nice video, thank you. Could you make a video with a few examples to show the differences between htmlspecialchars() and filter_input()?
@Dani_Krossing Жыл бұрын
htmlspecialchars() simply converts any special characters into HTML entities. So for example "&" would become "&", which makes it "non-dangerous". Where as filter_input() actually sanitize the data, by returning false if the input was invalid. It's important to mention here though, that php.net recommends always using htmlspecialchars() for string data. 🙂 But if you are dealing with other types of data, then you can use either function, depending on what you are trying to do.
@mortwain1809 Жыл бұрын
@@Dani_Krossing thnx for explanation
@sonamohialdin3376 Жыл бұрын
This is very useful tutorial thank you
@deitunegold4593 Жыл бұрын
Hello dani, I’m trying to learn how to create a chat system in php. I feel like learning that would take me to another level. Can you do tutorial on that please ?☺️
@alexsaptetrei Жыл бұрын
In case of divide, i would also check the value of num2. Division by 0 is an illegal operation.
@WillemsWimMH7 ай бұрын
About double or single quotes around 28:15 I did notice that in my code when I don't use quotes to define the class in html it works fine too (in something I created myself). I wrote the following:
@Dani_Krossing7 ай бұрын
You should always follow the regular HTML rules, even when putting it inside PHP. 🙂 There could very well be a specific reason why in your case it works, but maybe not when others test it on their devices or browsers.
@jujomoto Жыл бұрын
great tuto, thanks for sharing 😃
@AleJFF25 Жыл бұрын
The letter "e" at 21:52, is it not the Euler's constant? Maybe HTML considers it at a number. Or more likely to be like 1e10 for example, to the power of 10.
@Sweetcommando7 ай бұрын
Yeah I think he just managed to type in the one letter by chance that can be inputted in there lol
@nihongo_ Жыл бұрын
Thank you bro
@nenadkardum63910 ай бұрын
Hello Dani!! Thank you for your videos and all your efforts, you are an awesome person and great teacher! 💪💪💪 I have problem when trying to do some math in "our" calculator. The message I get is this one: Fatal error: Uncaught Error: Undefined constant "num02" in C:\xampp\htdocs\test.php:44 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test.php on line 44 This is part of code if (!is_numeric($num01) || !is_numeric(num02)){ echo "Only write numbers!"; $errors = true; } is causing error..when I delete it then it all works fine. I will put my whole work in next comment so if you have time please take a look at it.
@AxxionMarketPlace-iu6ri Жыл бұрын
Thank you
@nancyosumba53509 ай бұрын
Hi Daniel, your videos have been very useful for a beginner like me. Wanted to ask if you can create a video showing how to create a to do list with php. it should have this functions PHP, HTML, and CSS with a connection to an SQL database containing a table for tasks (Bootstrap/Tailwind/Sass or other can be used for styling). Each task should have: A unique ID A title A task description Completion status (whether the task is done) The user should be able to: View all tasks Add a task Edit a task Delete a task Mark a task as completed. Enable the creation of different users on the page and have multiple task lists associated with a specific user, editable only by that user and not visible to other users. Implement functionality to remove all completed tasks. Implement functionality to mark all tasks as completed. Allow users to register and log in to the page, and provide the capability to change their username and other settings such as the page's color theme or other similar preferences. once again thank you for your work much appriciated.
@drlawrencemayo2 ай бұрын
Hi danni im a doctor in medical field, can we do a medical oriented project on you channel. such as patient database using php?
@guillerjamesmantala73112 ай бұрын
thankyou sir
@jahidsafiullah72704 ай бұрын
Love from Bangladesh
@Stoney_Eagle Жыл бұрын
Hehe really hammering down on the security, almost sounds like you enjoy it 😂
@Dani_Krossing Жыл бұрын
haha well when people keep telling me to use "HTML as security", I do find it satisfying to prove those comments wrong in a video 😂 Or at least from knowing that this video won't get those comments.
@harshwebdeveloper Жыл бұрын
really it's helpful video
@zorenromera Жыл бұрын
in the select option if I select multiplication or any other operation after submitted, the select option back to addition it's kind a (default), how can I possibly stick with the chosen operation even if I submit the form? I am hoping to your answer teacher Dani :D
@achmaliki8389 Жыл бұрын
i used match over switch, is there better use switch rather than match ?
@User97356 Жыл бұрын
THANK YOU.. can you make a payment system
@jeanwill696 ай бұрын
Just wondering why using float when you can't entering float number when using type="number" in html ? Thanks, JF
@Couldbeme Жыл бұрын
Woah that’s cool!
@vedantpillai3538 ай бұрын
Hello, I have just started learning php. At 22:48 the is_numeric function also seems to check whether the given variable is empty or not. So, if we use only that if block and remove the if block from 20:38, would it give me some kind of error?
@abubakarrishi5332 Жыл бұрын
Ahh thanks also I want social website in php please project making
@RespectEveryoneForever7 ай бұрын
bro how u arranged it fast on 25:51, u alligned it very quick
@rogerrives70969 күн бұрын
I found out why it was not working with floats. In the form when we set the
@rogerrives70969 күн бұрын
I love the course by the way
@rogerrives70969 күн бұрын
and like @TheSocks221 pointed out you also need to include " $num1 = filter_input(INPUT_POST, "num1",FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); $num2 = filter_input(INPUT_POST, "num2",FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);"
@lucaslannes4004 Жыл бұрын
Hello from Brazil! Why did you use "echo" before htmlspecialchars, after all echo is not to just show something on screen? I tried without it and worked the same. I mean, is there a purpose or does the same? . Its my second day learning PHP, be patient😅
@Dani_Krossing Жыл бұрын
Echo is used to show content on screen, and htmlspecialchars is used to prevent the outputted content to be malicious 🙂 so our website doesn’t get attacked using XSS.
@PicnicGamingX Жыл бұрын
would it not be better if we use AND instead of OR while checking if the number is not numeric
@Dani_Krossing Жыл бұрын
No because if you put a AND instead, then both have to not be numbers before it counts as an error. 🙂 If you put a OR then only one of them has to not be a number.
@PicnicGamingX Жыл бұрын
@@Dani_Krossing Thank you so much for removing my confusion. Your tutorials are really helpful. I have a request for you to make tutorials of Laravel also because, i started internship as Laravel developer and i find laravel really hard to use. Out of all the internet i find only your tutorials helpful so please make Laravel tutorial series.
@zeuz396111 ай бұрын
22:22 "e" is actually a number :D just like "i" but it is not imaginary :P
@fotonext7441 Жыл бұрын
Can I use FILTER_VALIDATE_FLOAT instead of FILTER_SANITIZE_NUMBER_FLOAT? Is the same thing? Or are there differences?
@heinzerbrew8 ай бұрын
one santitzes the other validates
@adobeadobe16165 ай бұрын
I'm having a problem with create html canvas elements with php.. Things that work in html canvas with an html file work, but when i use da canvas element and select it in a js file with php it doens't show..
@EL_WAFI_CHERKAOUI6 ай бұрын
i have quetions , why you wrote echo inside action attr in form , why do we need to echo the data ? isnt action attr work is to send data to server ? why echo then ?
@DigitaleDemocratie71411 ай бұрын
Hello, i créated the calculator but i have a problem. The file works om my brothers Mac but not on my win10. The echo’s do not work on my pc. I don’t see the result and the other echo massages. I use the latest versión of xampp . It’s not a mistake in the script because it works on my brothers system. Other echo’s outside of the calculator do work. What could be be the problem?
@AndiBradley5 ай бұрын
I tried to do a calculation 100 / 0.5 and it gave me an error. Is that my browser causing that or something else? Anything with a decimal point causes an error. Maybe the age of my PHP software?
@tendounosaiba83669 ай бұрын
How can you autocomplete HTML in PHP sir?
@heinzerbrew8 ай бұрын
Sanitizing numbers instead of just veirfying that they are numbers seems like a bad idea. How can you trust that the sanitized data was the intended input?
@heinzerbrew9 ай бұрын
I am confused why do you say PHP_SELF can be altered by a malicious user? (starting around 4 minute mark) Edit: it seems that it isn't actually the file itself that is referenced, but instead the url in the browser including any random extra stuff that a person types into the url...
@marlo4108 Жыл бұрын
but it does not accept float numbers
@GoldDiscover333 Жыл бұрын
Sir some people says that php shall be end! He is really kindly cover this topic in specific video
@Dani_Krossing Жыл бұрын
My first video in this series, talks about that specific issue. 😊 Spoiler alert, "PHP is not dying" hehe
@go_all_the_way6 ай бұрын
Can't access the project files. It seems like there is text in the description that is intended to be a hyperlink but instead is just plain text. Anyone else having this issue?
@Dani_Krossing6 ай бұрын
The "➤ GET ACCESS TO MY LESSON MATERIAL HERE!" is just the header. The links are bellow. 🙂
@danieligbinidu6880 Жыл бұрын
💯💯💯💯
@namataymichael58416 ай бұрын
Echo out for Result is not showing text .. maybe something went wrong
@chytoms6 ай бұрын
Check on your stylesheet! Had same problem but after unlinking my stylesheet everything is fine unless your code got a problem in which case you can turn on display_errors in your php.ini file to see the exact line with the error
@HubertAgbozo Жыл бұрын
I got an error : Fatal error: Uncaught TypeError: filter_input(): Argument #3 ($filter) must be of type int, string given in C:\xampp\htdocs\PHP calculator\index.php:39 Stack trace: #0 C:\xampp\htdocs\PHP calculator\index.php(39): filter_input(0, 'operator', 'add') #1 {main} thrown in C:\xampp\htdocs\PHP calculator\index.php on line 39
@Dani_Krossing Жыл бұрын
It means you accidentally set the operator to check for an integer, when you use the filter check.
@godstimesamuel36332 ай бұрын
Hi sir, I tried this out on my laptop but it ain’t working 😌
@jggh88hvhj14 күн бұрын
I couldn't get why we used POST and not GET??
@constantine9074 Жыл бұрын
link is not working :(
@chanmyaemaung Жыл бұрын
You look quite similar to Elon Musk, so I had to ask whether the two of you are related. 🤭
@princessteranacaramrasonablehe6 ай бұрын
😂 I though it was only me who noticed
@tanzimwalweni656910 ай бұрын
Whenever you show any type of text thats html / css (not php) I lose track of the information im learning and things stop making sense. It would be easier if you JUST did php only.
@Dani_Krossing10 ай бұрын
Most PHP is done in coorporation with HTML, so it's important to learn how to use them together. 🙂 You should be very familiar with HTML already, if you started learning PHP. So if you struggle with the HTML part, then I recommend catching up on it, so it's easier to follow along.
@heinzerbrew9 ай бұрын
I'm guessing you are mememing, because he has said so many times that people don't like him showing non-php code.
@raphaelevangelio28972 ай бұрын
its irritating me that youre teaching very fast and didnt even explain how you did that echo of the error handlers. Now im still confused.