1

I have a page which I need to send two variables, 'my_book_id' and 'library_book_id'.

On that page I would code something that uses the variables.

I know that since WordPress pages are not exactly HTML pages or PHP files, I can't send variables via the URL and then get them for use on the page with $_GET['my_book_id'].

I want to implement something like this. How would I do it?

I am using permalinks and I have %postname% on the definitions.

Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
  • Does the answer to this question help you? http://stackoverflow.com/questions/4586835/how-to-pass-extra-variables-in-url-with-wordpress – Tim Joyce Dec 05 '12 at 14:54

2 Answers2

1

you can simply use:

<?php echo get_permalink( $page_id ) . '?my_book_id=' . 1 . '&library_book_id=' . 12; ?>

On the place where the link is build

janw
  • 6,672
  • 6
  • 26
  • 45
  • Thanks for all the answers, but i found this plugin : http://phpbase.in/free-scripts/qstring-wordpress-plugin/ and this exactly what i want ....thanks very much for your help! – Nuno Gouveia Dec 05 '12 at 15:20
1

Actually you can just use

    $_GET['my_book_id']

You can either get the variable by coding in your page/post template or,

(much better) by creating a plugin

Jean Paul
  • 912
  • 9
  • 18