• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
isset

#1
hi
im starter 

searched forum not found.

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

thank you

waiting
Reply

#2
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".
Reply

#3
(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
Reply

#4
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
Reply

#5
(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
Reply

#6
(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
Reply

#7
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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.