Search the Community
Showing results for tags 'php7'.
-
I am using VSC 2019 and PHP 7; when I Live View an HTML file I have no problem. When I try to Live View a PHP file I get the following message: Cannot GET /%20--use-spdy=off%20--disable-http2 I had no issues with the install of either Vs or PHP and verified my PHP is running correctly. I need a little guidance please.
-
Hello! Please explain to me how gender validations from scripts 2.3 differ from the nested one in script 2.4. I have this in 2.3 (updated with NULL coalescing operator while practicing Pursue section): $gender = $_REQUEST['gender'] ?? NULL; if ($gender == 'M') { $greeting = '<p><strong>Good day, Sir!</strong></p>'; } elseif ($gender == 'F') { $greeting == '<p><strong>Good day, Madam!</strong></p>'; } else { $gender = NULL; echo '<p class="error">Gender must be either "M" or "F"!</p>'; /* You may wonder how this last case may be possible, considering the values are set in the HTML form. If a malicious user creates their own form that gets submitted to your handle_form.php script (which is very easy to do), they could give $_REQUEST[‘gender’] any value they want. */ } and this in 2.4: if (isset($_REQUEST['gender'])) { $gender = $_REQUEST['gender']; if ($gender = 'M') { $greeting = '<p><strong>Good day, Sir!</strong></p>'; } elseif ($gender = 'F') { $greeting = '<p><strong>Good day, Madam!</strong></p>'; } else { $gender = NULL; echo '<p class="error">Gender must be either "M" or "F"!</p>'; /* You may wonder how this last case may be possible, considering the values are set in the HTML form. If a malicious user creates their own form that gets submitted to your handle_form.php script (which is very easy to do), they could give $_REQUEST[‘gender’] any value they want. */ } } else { // $_REQUEST['gender'] is not set. $gender = NULL; echo '<p class="error">You forgot to select your gender!</p>'; } It seems that these scripts do the same job, or I just can't figure out the difference, please help me to understand it. And also I want to if we could use NULL coalescing operator in script 2.4 some way. Thank you!
- 1 reply
-
- nested
- null coalescing operator
- (and 6 more)
-
Been studying your book for a while and noticed it is not too much different from the 4th edition. The book's using mysqli_ for database connection, and the php is still version 5.some. Meanwhile, php 7 has come to life and the pdo is ubiquitous nowadays. As well as MVC and more or less object oriented approach in general. Some books i know of (i'm not sure if i can mention them here) went through this and even their hands-on practice evolved from developing a simple CMS to an almost framework-like application. So, my question is: will you update your PHP & MySQL series?