...

View Full Version : Using $_GET method in an iframe?



crays
05-15-2008, 11:24 AM
Hi, i'm pretty new here and not sure if this is the place to post this.
I'm trying to use the $_GET method in a page which will be inside an iframe. Is there anyway to do so?
Lets say i have
www.test.com/user.php?name=pete

and i have an iframe within the user.php which links to iframe.php, within iframe.php i have the code Welcome <?php echo $_GET["name"]; ?>.

any help will be appreciated thanks~

Fou-Lu
05-15-2008, 03:42 PM
Think of an iframe as a window to another webpage. The only way to display that would be to use the _GET/_POST/__COOKIE to pass it to the new page.
The better solution would be to run through sessions instead, this way if each of the pages are located on your server the sessions will all access the same value, allowing data sharing between the different webpages.

Does that make sense?

crays
05-15-2008, 03:45 PM
Yeah, i wanted to use session. But then the problem is, i wanted to show this page with info if someone go to this user's page.

Fou-Lu
05-15-2008, 03:48 PM
Yep, ok then just pass it along to the included iframe url. Thats something that you will need with your targeting and just append the get parameter (or post) to the page to send it to.

Does that help to clear it up?

Stooshie
05-15-2008, 03:57 PM
When you call the frame you need to call it with the name parameter set from the main page. eg


<iframe src="framepage.php?name=<?php echo($_GET["name"]); ?>"></iframe>


--- EDIT ---
Ooops! I had started this in quick reply then got interupted. didn't realise everyone else had answered.

crays
05-15-2008, 04:19 PM
Thanks guys, useful info. Thanks alot !

ofk88
03-14-2009, 04:32 AM
When you call the frame you need to call it with the name parameter set from the main page. eg


<iframe src="framepage.php?name=<?php echo($_GET["name"]); ?>"></iframe>


--- EDIT ---
Ooops! I had started this in quick reply then got interupted. didn't realise everyone else had answered.

I registered to this forum just to thank you. you solved my all problems :D
greets from Turkey



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum