Title: Get Variable from Header into Post?
Last modified: August 18, 2016

---

# Get Variable from Header into Post?

 *  Resolved [badm00n](https://wordpress.org/support/users/badm00n/)
 * (@badm00n)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/get-variable-from-header-into-post/)
 * Hello all,
 * I’m trying to use a GET variable and dynamically include it into a post. I have
   the PHP_EXEC plugin installed so I can run php code in my post. However, I put
   the GET code in the header and it won’t include in the post. The code is as follows:
 * In the header.php:
 *     ```
       <?
       $tid = $_GET['tid'];
       if ($tid == "") {
       	$tid = 'none';
       }
       ```
   
 * and in the post:
 * `<?php echo $tid ?>`
 * Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [badm00n](https://wordpress.org/support/users/badm00n/)
 * (@badm00n)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/get-variable-from-header-into-post/#post-641476)
 * bump.
 * Anyone?
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/get-variable-from-header-into-post/#post-641478)
 * In your header:
 *     ```
       global $tid;
       $tid = $_GET['tid'];
       ```
   
 * In the post:
 * `<?php global $tid; echo $tid; ?>`
 *  Thread Starter [badm00n](https://wordpress.org/support/users/badm00n/)
 * (@badm00n)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/get-variable-from-header-into-post/#post-641479)
 * Sweet, global worked.
 * Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Get Variable from Header into Post?’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 3 replies
 * 2 participants
 * Last reply from: [badm00n](https://wordpress.org/support/users/badm00n/)
 * Last activity: [18 years, 6 months ago](https://wordpress.org/support/topic/get-variable-from-header-into-post/#post-641479)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
