Hello Need some help

Discussion in 'PHP' started by beven, Nov 29, 2011.

  1. #1
    hi,
    I have a file products.php where i retrieving data from a database. But at index.php when i make a hyperlink like this. I am also getting link title from database
    <a href="UR/product.php>link title</a>

    It works at my localhost

    but i also get <a href="url/ dynamically get from database>title also from database</a>

    like <a href="URL/cate>cate</a>

    But this time i can not redirect server to call product.php as i get values from URL to compare it & to show specific data in Product.php..

    Main Problem How to tell server to execute the product.php file every time when a link is clicked

    Thanks in Advance
     
    beven, Nov 29, 2011 IP
  2. codecre8r

    codecre8r Well-Known Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    128
    #2
    I sounds like you need to pass in a query string parameter to product.php to tell it which product you want to display. Your link in index.php would need to be written out like this:

    <a href='url/product.php?id=cate'>cate</a>

    In product.php, you can do this to get the query string parameter:

    
    
    $productid = $_GET['id'];
    
    
    Code (markup):
    You can then pass $productid to your SQL statement and only get the information for that product.

    If you post the code, I can give you a more specific answer.
     
    codecre8r, Nov 29, 2011 IP
  3. kids

    kids Active Member

    Messages:
    411
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    68
    #3
    All of what you want like a rewrite rule for .htaccess

    URL/cate ~~> products.php?id = cate

    Is it right?
     
    kids, Dec 1, 2011 IP