![]() |
Would you do this differently?
Just threw something together as practice. I'm wondering if you would code this differently. I know it's merely a few lines of code, but I'm sure there are people who can dissect it and code it more eloquently and efficiently than I have. I'm here to learn. Please pick it apart.
PHP Code:
|
Not one person would have done this differently? Surely it's not perfect code.
|
There is a lot of code that you were using unnecessarily. No reason to use a constant, a function and definitely shouldn't be exiting an application for no reason (additionally, if you're using "exit" and don't have a message to send with it, no need to use exit(). :)
PHP Code:
|
Eh, if he wants to stop the script without saying any message, it's not useless to have exit....
|
Yeah, while that's right, why would you want to exit before outputting the form again--poor usability.
|
Doesn't it only exit the PHP part? The other is just plain HTML, and should be outputted.. but this I'm not sure of.
|
Exit stops the current php script. Since he's using procedural and not an object-oriented approach, it will not display anything after the exit. Otherwise you would be correct. Never the less an exit there would be kind of useless since nothing PHP follows it anyway.
|
| All times are GMT. The time now is 08:52 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0