biedubbeljoe Posted March 4, 2007 Share Posted March 4, 2007 I have the following php code: <?php> if ($sortm == '' ){ $sortm = 'ibn'; } ?> which gave me the undefined variable error. I can't seemed to find what's wrong. thanks, Link to comment https://forums.phpfreaks.com/topic/41174-undefined-variable/ Share on other sites More sharing options...
marcus Posted March 4, 2007 Share Posted March 4, 2007 if(empty($sortm)){ $sortm = "ibn"; } You could use if(!isset($sortm)){ $sortm = "ibn"; } Link to comment https://forums.phpfreaks.com/topic/41174-undefined-variable/#findComment-199458 Share on other sites More sharing options...
Yesideez Posted March 4, 2007 Share Posted March 4, 2007 Replace <?php> with <?php Link to comment https://forums.phpfreaks.com/topic/41174-undefined-variable/#findComment-199459 Share on other sites More sharing options...
biedubbeljoe Posted March 4, 2007 Author Share Posted March 4, 2007 Thanks mgallforever that does the trick! You could use if(!isset($sortm)){ $sortm = "ibn"; } Link to comment https://forums.phpfreaks.com/topic/41174-undefined-variable/#findComment-199463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.