468,248 Members | 1,534 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,248 developers. It's quick & easy.

GET values not available when using META redirect

Within some PHP code I'm constructing a URL that includes some variables that I want to pass along with the URL. Something like www.MyWebSite.com/PageTwo.php?Param1=32. I intend to use this constructed URL within a META tag that will cause it to jump to that page. For example:

echo '<META http-equiv="refresh" content="0;URL=www.MyWebSite.com/PageTwo.php?Param1=32">';

That works fine. It does indeed jump to that page an dthe parameter is indeed included in the URL when it gets there.

But how then do I retrieve the values I passed? How do I get that Param1=32?
I initially thought that this would constitute something comparable to a GET type of form submit, so that the values would be available via the PHP $_GET function ( e.g. $TheParam = $_GET['Param1'] ) but that doesn't work.

Is there a method for retrieving parameters passed by URL? Or, alternatively, is there a way I can get that META tag to do a GET type submit?
Jun 17 '07 #1
5 1375
ak1dnar
1,584 Expert 1GB
These two php scripts are located at http://localhost/test/meta_and_get/ directory. and i executed the files with the expecting results from the second page. first try them without any other coding in it.

PageOne.php
Expand|Select|Wrap|Line Numbers
  1. <?php echo '<META http-equiv="refresh" content="0;URL=PageTwo.php?Param1=32">';?>
  2. // I removed full URL path and just put second page name here :)
  3.  
PageTwo.php
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. print 'PageTwo.php get Executed<br>';
  3. $param = $_GET['Param1'];
  4. print 'Param 1 is :'.$param;
  5. ?>
  6.  
  7.  
and got this in the screen:
PageTwo.php get Executed
Param 1 is :32
Jun 17 '07 #2
pbmods
5,821 Expert 4TB
Changed thread title to better describe the problem.
Jun 17 '07 #3
ajaxrand ,

Thanks for trying that out and showing me how to do it.

In my particular case I am trying to send MULTIPLE parameters at the end of the URL. When I try to do that with something like www.ThePage.com?a=hello?b=goodbye

and in the receiving page I do $FirstParemeter = $_GET['a'']. What I receive for $FirstParameter is "hello?b=goodbye". It's not splitting the paremeters. Obviously I'm not formatting that correctly, or not using the correct separator between the multiple parameters. How do I do that correctly?
Jun 17 '07 #4
Oh, I just figured it out. It uses ampersand to separate multiple parameters, not additional question marks.

All is fine now. Thanks for your help.

- Roger
Jun 17 '07 #5
ak1dnar
1,584 Expert 1GB
Oh, I just figured it out. It uses ampersand to separate multiple parameters, not additional question marks.

All is fine now. Thanks for your help.

- Roger
If you post all your codes in your original post i could help you .Sorry i was out of my Box for couple of hours just now read those new posts.Anyway you figured it out. :) well done !. Keep in touch with TSDN.

-Ajaxrand
Jun 18 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by TG | last post: by
3 posts views Thread by Mike C. Fletcher | last post: by
reply views Thread by Anne Snow | last post: by
6 posts views Thread by brian_mckracken | last post: by
8 posts views Thread by Taras_96 | last post: by
2 posts views Thread by phpmagesh | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.