• I am trying to figure out a way to pass an ID from one page to another.

    My current permalink structure is https://site/sample-post/

    echo '<td class = "column1"> <a href = "update.php?id=' . $obj->ID . '">' . $obj->ID . $obj->firstName . '</a></td>';

    I am trying to pass the $obj->ID to the next page so that it can load the correct information pertaining to that entry. The code above is the old way I did it before moving it to wordpress.

    I’ve tried loading all the ID’s to an array. It worked, but I could not figure out how to call the correct item from the array on the next page. I’m trying to figure out mod rewrite, but am unsure how to use it or make it work for this kind of situation. I also tried url_to_postid, but that did not work like I thought it would.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter lgndryhr

    (@lgndryhr)

    Got it to work kind of.

    echo '<td class = "column1"> <a href = "update?id=' . $obj->ID . '">' . $obj->firstName . '</a></td>';

    It changes the URL from update?id=12345 to update/?id=12345 and loads the correct information that is tied to that ID. But I want the URL to appear without the ?id=12345. Any advice?

    On the second page I have $ID=$_GET[‘id’] and that gets the ID to use.

    Thread Starter lgndryhr

    (@lgndryhr)

    Any help?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pass ID with pretty permalink’ is closed to new replies.