CodeIgniter Forums
isset - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: isset (/showthread.php?tid=77935)



isset - Jeewakapk - 11-06-2020

hi
im starter 

searched forum not found.

is there a substitute for isset (PHP) in CI4?

thank you

waiting


RE: isset - captain-sensible - 11-06-2020

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" />
//the key thing here is the name of the button which is 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".


RE: isset - Jeewakapk - 11-07-2020

(11-06-2020, 12:26 PM)captain-sensible Wrote: 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" />
//the key thing here is the name of the button which is 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".

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


RE: isset - captain-sensible - 11-07-2020

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


RE: isset - Jeewakapk - 11-11-2020

(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.

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


thank you so much


RE: isset - captain-sensible - 11-12-2020

(11-11-2020, 04:01 AM)Jeewakapk Wrote:
(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.

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


thank you so much
your welcome


RE: isset - includebeer - 11-14-2020

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');