• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to understand if parameter is empty

#1
Hi. For example i have a delete method in users controller. I want to if there is no parameter i should redirect the user.

For example these codes are not working. I am waiting advices.

PHP Code:
public function delete($incomingId)
 
   {
 
       if (empty($incomingId)) {
 
           redirect(base_url());
 
       }
 
   
or

PHP Code:
public function delete($incomingId)
 
   {
 
       if (!$incomingId) {
 
           redirect(base_url());
 
       }
 
   
PHP Code:
public function delete($incomingId)
 
   {
 
       if (!isset($incomingId)) {
 
           redirect(base_url());
 
       }
 
   
Reply

#2
PHP Code:
public function delete($incomingId null)
{
 
   if (is_null($incomingId)) {
 
       redirect(base_url());
 
   }

What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(06-16-2019, 01:24 PM)InsiteFX Wrote:
PHP Code:
public function delete($incomingId null)
{
 
   if (is_null($incomingId)) {
 
       redirect(base_url());
 
   }


Thanks it worked  Big Grin Big Grin
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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