isset |
hi
im starter searched forum not found. is there a substitute for isset (PHP) in CI4? thank you waiting
you might not need a substitute since you can use isset. For example
I have a form with a submit button input as follows : Code: <input type="submit" name="submit" class="btn btn-info"value="submit" /> in the controller that processes what was submitted from the form, i could check to see if the button was clicked with submit. As follows : Code: echo isset($_POST['submit']); i'm playing with forms at the moment and checked this still works , output was "1". (11-06-2020, 12:26 PM)captain-sensible Wrote: you might not need a substitute since you can use isset. For example Thank you so much. will be there any harm of mixing PHP core framework code with CI 4 code. like isset is PHP core framework code especially security risk Thank you so much. will be there any harm of mixing PHP core framework code with CI 4 code. like isset is PHP core framework code especially security risk
one thing i like about Codeigniter is that I can write pure Object Oriented php in a class of my own, with its member properties and methods , and then its easy to utilize with CI4.
I have a small number of my own php class and a couple of webs that are live; i've had no security or other problems due to using pure php. With some frameworks you get a choice of either pure php or framework slant "template language " like {{ @name }} in a view. I don't think there is that in CI4. So the short answer may be, not only is isset() ok but actually the only way of doing things is with "proper OOP php" of course due to ignorance i may be wrong :^) in fact if you look at some of the core classes it all looks nicely pure php to me (11-07-2020, 11:50 AM)captain-sensible Wrote: one thing i like about Codeigniter is that I can write pure Object Oriented php in a class of my own, with its member properties and methods , and then its easy to utilize with CI4. thank you so much
(11-11-2020, 04:01 AM)Jeewakapk Wrote:your welcome(11-07-2020, 11:50 AM)captain-sensible Wrote: one thing i like about Codeigniter is that I can write pure Object Oriented php in a class of my own, with its member properties and methods , and then its easy to utilize with CI4.
There's no problem using plain PHP, but you can also make your life easier by using CI's features.
For example, instead of doing this: PHP Code: $something = isset($_POST['foo']) ? $_POST['foo'] : NULL; ...you can do this, for the same result: PHP Code: $something = $request->getPost('foo');
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |