Discussion:
Resolving a PHP Notice Error
Ron Piggott
2013-09-17 19:38:22 UTC
Permalink
I am wanting to establish a default sort by preference when the user hasn’t specified one. I setup to test this with:

<?php

if ( !is_set( $sort_by_preference ) ) {

$sort_by_preference = "government_wording";

}

?>

But I am receiving a Notice error:

Notice: Undefined variable: sort_by_preference in GIFI_codes.php on line 11- Line 11 is “if ( !is_set( $sort_by_preference ) ) {“What is the correct way to test this without triggering a Notice error?Ron
Ron Piggott



www.TheVerseOfTheDay.info
Daniel Brown
2013-09-17 19:41:06 UTC
Permalink
On Tue, Sep 17, 2013 at 3:38 PM, Ron Piggott
Post by Ron Piggott
<?php
if ( !is_set( $sort_by_preference ) ) {
Did you create a function is_set(), or did you mean to use the
construct isset()?
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sebastian Krebs
2013-09-17 19:42:27 UTC
Permalink
Post by Ron Piggott
I am wanting to establish a default sort by preference when the user
<?php
if ( !is_set( $sort_by_preference ) ) {
$sort_by_preference = "government_wording";
}
?>
Notice: Undefined variable: sort_by_preference in GIFI_codes.php on line
11- Line 11 is “if ( !is_set( $sort_by_preference ) ) {“What is the correct
way to test this without triggering a Notice error?Ron
Ron Piggott
Because actually you are looking for isset() (not is_set()).
Post by Ron Piggott
www.TheVerseOfTheDay.info
--
github.com/KingCrunch
Continue reading on narkive:
Loading...