Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Undefined index: page

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #189241
    robetnobe
    Participant

    php $_GET and undefined index

    <?php
    if ($_GET['page']=='home')
    { include "modul/home.php";}
    else
    if  ($_GET['page']=='detail')
    { include "modul/detail.php";}
    ?>
    #189319
    robetnobe
    Participant

    to get a variable in the url php page that

    #189321
    __
    Participant

    @robetnobe, you need to use complete sentences and ask a specific question. It is not clear what problem you are trying to solve. It would also probably be helpful if you answered Benwalker’s question.

    #189327
    robetnobe
    Participant

    yes want to get the page url in php variable error occurs that is undefined index

    #189394
    robetnobe
    Participant

    ok thanks walker
    yes how to avoid showing error back

    #189396
    __
    Participant

    That’s a possible cause of your problem. If this is indeed what is causing your problem, then the solution is to check if $_GET['page'] exists before you try to use it:

    <?php
    // add this "isset" check:
    if( isset( $_GET['page'] ) ){
    
        if( $_GET['page']=='home' ){ 
            include "modul/home.php";
        }
        elseif( $_GET['page']=='detail' ){ 
            include "modul/detail.php";
        }
    
    }
    
    #189397
    robetnobe
    Participant

    ok i will try :)

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.