Title: Passing variable between pages
Last modified: August 21, 2016

---

# Passing variable between pages

 *  Resolved [zed28](https://wordpress.org/support/users/zed28/)
 * (@zed28)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/passing-variable-between-pages/)
 * Hi,
 * I have read many articles and post about passing variables between WP pages, 
   but just now I have got stuck 🙁
 * My problem:
    On first page I have three randomly listed posts with “read more”
   links.
 * I need to detect which link was clicked by user and pass this link as post ID
   to second page as variable, which I will use in javascipt (javascript hides/shows
   text blocks via document.getElementById(passed variable).className).
 * I know that I need to use onClick event on links on first page, but I do not 
   know how to assign “post ID” to onClick event and how to use passed parameter
   on second page.
 * Can anybody help me, please?
 * Alex

Viewing 1 replies (of 1 total)

 *  Thread Starter [zed28](https://wordpress.org/support/users/zed28/)
 * (@zed28)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/passing-variable-between-pages/#post-4391202)
 * I solved it!

Viewing 1 replies (of 1 total)

The topic ‘Passing variable between pages’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [zed28](https://wordpress.org/support/users/zed28/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/passing-variable-between-pages/#post-4391202)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
