SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: Get & Post?

  1. #1
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get & Post?

    I'm making the dinamic links that connect the foruns to the respective threads.
    How should i make those links?

    In the threads.php is a variable called $idforum that represents the Id of the forum the user wants.
    I tough the link would be http://www.example.com/threads.php?idforum=1 for example....

    How can i define a variable's value trought the link?

  2. #2
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Normally, u would tend to find the forum to which a thread belongs by looking up the thread ID in the database and finding corresponding forum entry.

  3. #3
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kailash Badu View Post
    Normally, u would tend to find the forum to which a thread belongs by looking up the thread ID in the database and finding corresponding forum entry.
    Yes, i'm using that way.
    The database has the thread_id and forum_id objects i use to connect each thread to his forum.

    But now its the first time i'm using the links.

    When i do this:

    "<tr><td><a href=...>".$Forum_Name."</a></td></tr>"
    i must tell php to make a link according to the database's information about his threads. So when the user reaches the threads.php, the page shows only the threads corresponding to the forum_id choosed before.

    I already made the threads.php and categories.php code, but now i need to link them, i need to make the 'dinamic url' that is different for each forum.
    a link containing this information for example:

    //www.sitepoint.com/forums/newreply.php?do=newreply&p=3208451

    But i dont know how to do this.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    grab the forum ids from the db, then loop over them, using echo to output the links concatenated with the id's

  5. #5
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher View Post
    grab the forum ids from the db, then loop over them, using echo to output the links concatenated with the id's
    yes, but my problem is that i dont know how to do the links concatenated with the id's...
    How can i make threads.php receive the info trought the links concatenated with the id's made by categories.php??

  6. #6
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone..?

  7. #7
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem, lambda, is that i didn't quite understand what u want to do. Will u mind rephrasing your problem?

  8. #8
    SitePoint Addict AfroNinja's Avatar
    Join Date
    Oct 2006
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You just do that yourself. Whatever you stick into the url will be received by the get superglobal. Let's say you have an array that contains ids all of your categories. You could create links like this:

    PHP Code:
    $categories = array(1,3,4,7,2);

    foreach(
    $categories as $cat)
    {
    echo 
    '<a href="mysite.com/displaycategory.php?id="'.$cat.'">Click here</a><br />';

    that would display a list of links, each going to a different category page. Then on the displaycategory.php page you would grab the id with $_GET['id'];

    make sure to properly sanitize it first though.
    The Flash Gaming Network
    Editorial reviews for the latest flash games!
    Afro Ninja Productions
    Original flash games and content from a guy with an afro

  9. #9
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!
    Sorry Kailash Badu, but i'm from portugal, english is not my main language, and sometimes i have diffuculty explaining somethings.

  10. #10
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!
    Sorry Kailash Badu, but i'm from portugal, english is not my main language, and sometimes i have diffuculty explaining somethings.
    Well, that is ok. I am glad that your problem was solved.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •