Pass variable from page to included PHP
-
My ultimate goal is to have the ability to comment on all pages within my site … however not all pages are handled with WordPress. The pages outside of WordPress are all based on a template called “player.php” and are filled with dynamic information from a database based on “playerID” variable.
For example, mysite.com/player.php?playerID=1 would show a page about Michael Jordan. mysite.com/player.php?playerID=2 would show a page about LeBron James.
My solution was to make a WordPress page for each individual playerID. All each page would have as its content is the following (using a PHP plugin of course):
<?php $playerID = 1; include("player.php"); ?>
The include works correctly, but the variable NEVER gets passed. I’ve been trying so many ways to get this over but I can’t seem to make any progress. Any suggestions out there?
Thanks in advance!
- The topic ‘Pass variable from page to included PHP’ is closed to new replies.