Help me about PHP coding

Discussion in 'PHP' started by jennypretty, Oct 2, 2008.

  1. #1
    Hello,

    I have a dating site, www.usmatch.info

    I created a line from htaccess file and it works when I type in directly on the browser, www.usmatch.info/1.html (orginial url is www.usmatch.info/index.php?pg=1)

    Here it is: RewriteRule ^([^/]*)\.html$ /index.php?pg=$1 [L]

    When I click on the 2nd or 3rd page, it goes back to normal urls like, /index.php?pg=2, /index.php?pg=3

    I have links for the rest of dynamic pages to read as 1, 2, 3, 4, ...16

    How do I change the code in PHP to move to next page with friendly pages like, www.usmatch.info/2.html, 3.html, ....

    here is the block of code:

    <?
    if($pages>1)
    {
    if ($pg!=1)
    {
    ?>
    <a href="<? echo $_SERVER['PHP_SELF'];?>?pg=<?php echo ($pg-1).$strpass; ?>" >
    <?
    }
    ?>
    Prev
    <?
    if ($pg!=1)
    {
    ?>
    </a>
    <?php
    }
    ?>
    <B>&nbsp;
    <?
    if ($pages>1)
    {
    ?>
    </B>
    <?php
    if ($pg<=15)
    {
    $jmpcnt=1;
    }
    else
    {
    $jmpcnt=$pg-15;
    }
    $cnt=0;

    while ( $jmpcnt<=$pages && ($cnt<=15) )
    {
    $cnt++;
    if ($jmpcnt!=$pg)
    {
    ?>
    <a href="<? echo $_SERVER['PHP_SELF'];?>?pg=<?php echo "$jmpcnt$strpass"; ?>" >
    <?
    }
    else
    {
    echo "<b>";
    }
    echo $jmpcnt;
    if ($jmpcnt!=$pg)
    {
    ?>
    </a>
    <?php
    }else{
    echo "</b>";
    }
    if ($jmpcnt<$pages)
    echo " &nbsp; ";
    ?>
    <?php
    $jmpcnt = $jmpcnt + 1;
    }
    ?>
    &nbsp;</font> <font class="normal">
    <?
    }

    if ( $pg!=$pages && $pages<>0)
    {
    ?>
    <a href="<? echo $_SERVER['PHP_SELF'];?>?pg=<?php echo ($pg+1); ?><?php echo "$strpass"; ?>" >
    <?
    }
    ?>
    Next
    <? if ($pg!=$pages && $pages<>0)
    {
    ?>
    </a>
    <?
    }
    }
    ?>

    I already tried but it generated errors.

    Need your help.

    Thank you for reading this.

    Jenny.
     
    jennypretty, Oct 2, 2008 IP
  2. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #2
    zac439, Oct 2, 2008 IP
  3. jennypretty

    jennypretty Active Member

    Messages:
    584
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    You need to enter directory.
    www.usmatch.info/1.html

    That link should work. When I click on next page, it comes back to index.php?pg=2,

    how do I make it dynamic?

    When I click on 2nd page, the url should be /2.html
    thanks.
     
    jennypretty, Oct 2, 2008 IP
  4. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #4
    HTACCESS, if it were working correctly, would handle that automatically. The problem is in your HTACCESS.

    This may help you out: http://cooletips.de/htaccess/
     
    zac439, Oct 2, 2008 IP