Helo all,im using this to switch trought the menus and current page stats active, this is only part of code for menu.

<?php
//Full page list
$pages = array(
   "file1"=>"Index",
   "file2"=>"Page 2",
   "file3"=>"Page 3",
   "file4"=>"Page 4",
   "file5"=>"Contact",
   );
//Get Page selected
$page = (empty($_GET['str']))?"startpage.html":$_GET['str'];

//Display links
echo PageLinks($page,$pages);

   ?>

but the menu is shown as this:
1
2
3
4
5

now please help me i need horizontal one:
1 2 3 4 5

    And what does the html code for the menu look like?

      theres no html code, this part generates links

      $pages = array(
         "file1"=>"Index",
         "file2"=>"Page 2",
         "file3"=>"Page 3",
         "file4"=>"Page 4",
         "file5"=>"Contact",
         ); 

      maybe is better to show entire code.

      this is code for bringing pages and change then while the menu have their style.

      <?php
      
      
      //check selected page is correct name format
      if(preg_match('/^[\-_a-z0-9]+$/i', $page)){
         $file = "$page.html";
         //check page exists
         if(file_exists($file)){
            include($file);
            exit;
         }
      }
      //any faults display home page
      include "index.html";
      
      function PageLinks($page, $pages){
         $str = "";
         foreach($pages as $k => $v){
      if($page == $k){
               $str .="<li class=\"selected\"><a href=\"index.php?str=$k\">$v</a></li>\n";
            }else{
               $str .="<li class=\"unselected\"><a href=\"index.php?str=$k\">$v</a></li>\n";
            }
      	     }
         return $str;
      }
      ?>
        kodlovac;10941179 wrote:

        theres no html code

        While amusing as a comment in the matrix (There is no spoon), trust me: There is indeed html code.

        kodlovac;10941179 wrote:

        , this part generates links

        $pages = array(
           "file1"=>"Index",
           "file2"=>"Page 2",
           "file3"=>"Page 3",
           "file4"=>"Page 4",
           "file5"=>"Contact",
           ); 

        No it doesn't. It creates an associative array and assigns it to $pages.

        If this is used in combination with the code in the first post, $page has a default value of startpage.html (and .html is a good hint, albeit certainly no guarantee, as to what's found inside this file: html code).

        kodlovac;10941179 wrote:

        if(preg_match('/[-_a-z0-9]+$/i', $page)){
        exit;
        }

        include "index.html";

        But there is a . in startpage.html, so this regexp fails, and index.html is displayed instead. If this is the behaviour you want, you should still consider achieving it in a less roundabout way.

        This part generates html code. Well, unless you set the content type header to text/plain, in which case it's just plain text. But then, you'd not see digits 1 through 5, you'd see the actual markup as well.

        kodlovac;10941179 wrote:

        foreach($pages as $k => $v){
        if($page == $k){
        $str .="<li class=\"selected\"><a href=\"index.php?str=$k\">$v</a></li>\n";
        }else{
        $str .="<li class=\"unselected\"><a href=\"index.php?str=$k\">$v</a></li>\n";

        You are missing opening and closing ul tags. Other than that, you just have to change li's display type or make it float, since the default display value for li is block.

          sry its not startpage.html, its only startpage..that was fast typing from mind..thats defined first selected link in menu, on this example file1

          yes i understand what are you saying, but the php code from first post generates menu in place where is located.

          if($page == $k){
          $str .="<li class=\"selected\"><a href=\"index.php?str=$k\">$v</a></li>\n";
          }else{
          $str .="<li class=\"unselected\"><a href=\"index.php?str=$k\">$v</a></li>\n";

          the thing works also with p class, and im not sure how and where exacly to put <ul></ul> codes to test it.

          and my silly newbie test is to replace <li class... with <td class... then it shows in horizontal direction, but the menu text have no class then.

            <li .... is a list going down vertically
            can you test with <span ... which is horisontally
            Like this:

            if($page == $k){
            $str .="<span class=\"selected\"><a href=\"index.php?str=$k\">$v</a></span>\n";
            }else{
            $str .="<span class=\"unselected\"><a href=\"index.php?str=$k\">$v</a></span>\n"; 

              wow thank you very much. that worked.
              never thought about this.

                Don't use span tags, keep the li tags. This keeps the semantic meaning of your list of links (after all, that is what it is). Semantics is very important these days, and can mean the difference of high or low search engine rankings.

                As johanafm mentioned, you need to change the list display type. In the <ul> tag (that you should have added!) give it a class like navbar, so that it looks like:

                <ul class="navbar">

                Then, in your .css file, add this:

                .navbar
                {
                    list-style-type: none;
                }
                .navbar li
                {
                    display: inline;
                }
                
                  Write a Reply...