Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Undefined array key help

    https://dev.pezcollectors.com - PHP 8.1
    Wrote custom menu system for my ~180 newsletter ez-pages. In tpl_page_default.php I check chapter number to use built in menu or mine like so:
    Code:
    if ($_GET['chapter'] >= "2000") { new menu crap }
    
    if ($_GET['chapter'] < "2000") { default EZP TOC }
    It all works as I want, but if you hit an ez-page that doesn't have chapters it throws PHP Warning: Undefined array key "chapter". I have tried wrapping it with !empty and isset but it still throws the error. Probably cuz I'm still trying to compare the number?

    Can someone please help me with the correct syntax for if chapter >= 2000 do new, if chapter empty OR < 2000 do old?
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,699
    Plugin Contributions
    11

    Default Re: Undefined array key help

    just use the var $chapter_id.

    see:

    https://github.com/zencart/zencart/b...er_php.php#L27
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: Undefined array key help

    Too easy! Can't believe how much time I wasted on that. Thank you very much!!!
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,576
    Plugin Contributions
    88

    Default Re: Undefined array key help

    Quote Originally Posted by gothstone View Post
    Too easy! Can't believe how much time I wasted on that. Thank you very much!!!
    I once 'lost' 4 hours to a semi-colon.

 

 

Similar Threads

  1. v158 Undefined array key 0 in includes/functions/general.php on line 354.
    By cubmanky in forum General Questions
    Replies: 1
    Last Post: 23 Aug 2023, 10:01 PM
  2. UPS Shipping Undefined array key "methods"
    By bumba000 in forum General Questions
    Replies: 1
    Last Post: 26 May 2023, 07:19 PM
  3. Replies: 1
    Last Post: 1 Apr 2022, 06:58 AM
  4. Warning: array_merge() [function.array-merge]: Argument #1 is not an array
    By antieuclid in forum PayPal Express Checkout support
    Replies: 3
    Last Post: 19 Jul 2010, 02:50 AM
  5. Replies: 3
    Last Post: 20 May 2008, 12:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR