• Resolved aaen

    (@aaen)


    Hi,

    Developing my first plugin, I have run into some problems. My plugin is displayed on a standard page. On this page, I have an index with links for every letter in the alphabet. When the user clicks a link, I want to display all records from the database that has a name that starts with the selected letter. However, I can’t catch the GET vars. My links look like this:

    <a href="?action=index&ltr=A">A</a>

    The function where I handle the links looks like this:

    if ( isset( $_REQUEST['action'] ) ) {
      switch( $_REQUEST['action'] ) {
    	case 'search' :
    	  $output .= do_search();
    	  break;
    	case 'index' :
    	  $output .= show_index();
    	  break;
      }
    }

    The search action works fine when I submit the search form (action=post), but the show_index() function does not get called when i click on the link above.

    I’m fairly new with both php and wordpress, so I’m probably just doing something wrong, but I can’t figure out what.

    Any suggestions will be appreceated.

    /Rasmus

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kafkaesqui

    (@kafkaesqui)

    I see nothing wrong with your switch construction from here. Are you sure about what show_index() is returning?

    moshu

    (@moshu)

    Just wondering…
    Are you trying to do something similar as this plugin?
    https://www.nateomedia.com/wares/downloads/wordpress/wp-snap/

    Thread Starter aaen

    (@aaen)

    Thanks for the replies. The problem disappeared magically the day after I posted the question. I’m still not sure what caused it but it was probably some stupid typo somewhere that I corrected without realising that it had anything to do with the problem above…

    Again, thanks for the replies. It’s good to know that it is easy to get answers. I’m really impressed with WordPress and how easy it is to get started.

    /Rasmus

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘problem getting $_REQUEST vars in page’ is closed to new replies.