Current location: Hot Scripts Forums » Programming Languages » PHP » pass variables to a .php page within a page


pass variables to a .php page within a page

Reply
  #1 (permalink)  
Old 04-21-04, 05:47 PM
davidcsi davidcsi is offline
New Member
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
pass variables to a .php page within a page

is it possible, say I have this page:

<html>
<body>
<?php
blah blah
?>

<img src="whatever.php">
</body>
</html>

is it possible to pass whatever.php the SAME variables I got on the master document? without implicitly passing it?? i.e. whetever.php?same=variable...

Thanks!
Reply With Quote
  #2 (permalink)  
Old 04-21-04, 07:32 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
PHP Code:

<html>

<body>
<?php
blah blah
?>

<img src="whatever.php?variable=<?php echo $_GET['variable']; ?>">

</body>
</html>
Reply With Quote
  #3 (permalink)  
Old 04-21-04, 07:34 PM
Chroder Chroder is offline
Newbie Coder
 
Join Date: Sep 2003
Location: Toronto, Ontario
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
You could loop through the $_REQUEST (cookies, post's, and get's) or $_GET array and create the query string.

PHP Code:

$query '';

foreach(
$_REQUEST as $key => $val)
{
    
$query .= "$key=$val&amp;";
}

echo 
"<img src=\"whatever.php?$query\">"
You might want to URL encode the $val's though.
__________________
DevBox.net | DevBoxForums.com

Last edited by Chroder; 04-21-04 at 07:38 PM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically refresh page after page load failure jdugger JavaScript 3 08-05-10 09:16 AM
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
page browsing problem mivec PHP 3 04-17-04 03:43 AM
i need to pass value of one page to another but using only javascript traceMe JavaScript 2 12-30-03 03:55 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 10:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.