WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] problem getting $_REQUEST vars in page (4 posts)

  1. aaen
    Member
    Posted 6 years ago #

    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

  2. Kafkaesqui

    Posted 6 years ago #

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

  3. moshu
    Member
    Posted 6 years ago #

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

  4. aaen
    Member
    Posted 6 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags