By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,637 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

question on passing a "variable" back to a calling page

P: n/a
Hello PHP Group,

I have a php page that calls another php page to load a image from a
database (mysql) in to the calling page.
It works like this:
first_view.php has
<img src="image.php?img=5" width="200" border="1" alt="Image of
Sunset">
the image.php opens the database and returns the image to the page
(first_view.php).

image.php can (does) also pull the title of the image being loaded to
first_view.php out of the query where the image data is send back:

I send the image data back like this:

//echo back the image data
header("Content-type: image/jpeg");
echo base64_decode($encodeddata);

I have a <p></ptag under the image tag, and would like to put the
title from the database there.
How can I pass the title of the image back to first_view from
image.php.

There is no html in image.php.
Thanks for a good group!

ewholz

Dec 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Easiest way would just be to at the beginning of image.php to add the
following line at the top of the code:

<?
require_once("first_view.php");
.....

Then create a function in there
function GetTitle( $ImageNumber )
{
return m_The_Image_Title;
}

and maybe another function which gives you the image source code?

function GetImage( $ImageNumber )
{
echo ' <img src="'.$imgNum.'" width="200" border="1"
alt="'.GetTitle($ImageNumber).'"';
}

That'd be easiest seeing as how it appears you have access to the
first_view.php file, so you can access methods in there.

Jason

On Dec 27, 8:20 pm, "eholz1" <ewh...@gmail.comwrote:
Hello PHP Group,

I have a php page that calls another php page to load a image from a
database (mysql) in to the calling page.
It works like this:
first_view.php has
<img src="image.php?img=5" width="200" border="1" alt="Image of
Sunset">
the image.php opens the database and returns the image to the page
(first_view.php).

image.php can (does) also pull the title of the image being loaded to
first_view.php out of the query where the image data is send back:

I send the image data back like this:

//echo back the image data
header("Content-type: image/jpeg");
echo base64_decode($encodeddata);

I have a <p></ptag under the image tag, and would like to put the
title from the database there.
How can I pass the title of the image back to first_view from
image.php.

There is no html in image.php.
Thanks for a good group!

ewholz
Dec 28 '06 #2

P: n/a
a separate DB query in the main php page.. grab all the info except
for the image data
ie, title, width, height (if stored), filename, whatever, etc..

eholz1 wrote:
Hello PHP Group,

I have a php page that calls another php page to load a image from a
database (mysql) in to the calling page.
It works like this:
first_view.php has
<img src="image.php?img=5" width="200" border="1" alt="Image of
Sunset">
the image.php opens the database and returns the image to the page
(first_view.php).

image.php can (does) also pull the title of the image being loaded to
first_view.php out of the query where the image data is send back:

I send the image data back like this:

//echo back the image data
header("Content-type: image/jpeg");
echo base64_decode($encodeddata);

I have a <p></ptag under the image tag, and would like to put the
title from the database there.
How can I pass the title of the image back to first_view from
image.php.

There is no html in image.php.
Thanks for a good group!

ewholz
Dec 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.