473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need a script to tell me where a hyperlink originated

Not sure if this is a php or an html question but I'll post it anyway.

I have multiple thumbnail images on my catalogue page catalogue.php and they are
all hyperlinked to a single page called desc.php that will give an enhanced
description of the product selected.

I want the desc.php page to print the contents of a text file named ?.txt based
on which image was clicked on in my catalogue page.

example: if I click on 1.jpg in my catalogue then I want the file 1.txt to be
selected and printed on my description page.

I know how to print the contents of a textfile and I know how to disect the
strings of the filenames so that I can associate 1.txt with 1.jpg.

What I dont know is how to retrieve the name of the image file that was clicked
on the catalogue page within my script for the desc.php page

If I didn't use a hyperlink image and used a form submit button instead on my
catalogue page then of course I could use something like:

$filename = $_POST['filename']

Hope you understood all of that.

Regards
Dynamo

Jul 17 '05 #1
4 1716
"Dynamo" <Dy***********@newsguy.com> wrote in message
news:co*********@drn.newsguy.com...
Not sure if this is a php or an html question but I'll post it anyway.

I have multiple thumbnail images on my catalogue page catalogue.php and they are all hyperlinked to a single page called desc.php that will give an enhanced description of the product selected.

I want the desc.php page to print the contents of a text file named ?.txt based on which image was clicked on in my catalogue page.

example: if I click on 1.jpg in my catalogue then I want the file 1.txt to be selected and printed on my description page.

I know how to print the contents of a textfile and I know how to disect the strings of the filenames so that I can associate 1.txt with 1.jpg.

What I dont know is how to retrieve the name of the image file that was clicked on the catalogue page within my script for the desc.php page

If I didn't use a hyperlink image and used a form submit button instead on my catalogue page then of course I could use something like:

$filename = $_POST['filename']

Hope you understood all of that.

Regards
Dynamo


The easiest and most common method is to use $_GET to indicate the filename.
Other than that, I believe the only way to use an image the way you want to
use it, is to use it as a form submit button.

- JP
Jul 17 '05 #2
On Mon, 29 Nov 2004 16:09:47 GMT, "kingofkolt"
<je**********@comcast.net> wrote:
"Dynamo" <Dy***********@newsguy.com> wrote in message
news:co*********@drn.newsguy.com...
Not sure if this is a php or an html question but I'll post it anyway.

I have multiple thumbnail images on my catalogue page catalogue.php and

they are
all hyperlinked to a single page called desc.php that will give an

enhanced
description of the product selected.

I want the desc.php page to print the contents of a text file named ?.txt

based
on which image was clicked on in my catalogue page.

example: if I click on 1.jpg in my catalogue then I want the file 1.txt to

be
selected and printed on my description page.

I know how to print the contents of a textfile and I know how to disect

the
strings of the filenames so that I can associate 1.txt with 1.jpg.

What I dont know is how to retrieve the name of the image file that was

clicked
on the catalogue page within my script for the desc.php page

If I didn't use a hyperlink image and used a form submit button instead on

my
catalogue page then of course I could use something like:

$filename = $_POST['filename']

Hope you understood all of that.

Regards
Dynamo


The easiest and most common method is to use $_GET to indicate the filename.
Other than that, I believe the only way to use an image the way you want to
use it, is to use it as a form submit button.

Depending on the code you use to load the image and build the
hyperlink around it, you'd simply add the name of the file to each
hyperlink as you build it:

<A HREF="desc.php?selected=1.jpg" SRC="1.jpg">
<A HREF="desc.php?selected=2.jpg" SRC="2.jpg">
for example.
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Jul 17 '05 #3

Dynamo wrote (in part):
I have multiple thumbnail images on my catalogue page catalogue.php and they are all hyperlinked to a single page called desc.php that will give an enhanced description of the product selected.

I want the desc.php page to print the contents of a text file named ?.txt based on which image was clicked on in my catalogue page.

example: if I click on 1.jpg in my catalogue then I want the file 1.txt to be selected and printed on my description page.


How are you specifying the link now?

If you have something like this:
<a href="desc.php"><img src=1.jpg></a>

You should do:
<a href="desc.php?img=1"><img src=1.jpg></a>

In your file desc.php, you obtain the value by looking at $_GET['img']
Ken

Jul 17 '05 #4
In article <11**********************@f14g2000cwb.googlegroups .com>, Ken Robinson
says...

How are you specifying the link now?

If you have something like this:
<a href="desc.php"><img src=1.jpg></a>

You should do:
<a href="desc.php?img=1"><img src=1.jpg></a>

In your file desc.php, you obtain the value by looking at $_GET['img']
Ken


Thank you so much!! That seems to work. Don't even have to use the form tag in
my html. In addition, by assigning the value 1 to img I dont have to worry about
disecting the strings to associate 1.jpg with 1.txt. I can use something like
$filetoopen= $_GET['img']. '.txt'

Many thanks
Dynamo
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Chris Martin | last post by:
Background: Our main menu is built using a simple unordered list containing other ULs. There is a table on a page that holds the subnav. Because of certain circumstances, I need to build the subnav...
3
by: Bobby | last post by:
I asked around about my problem, but so far no one has replied to me so I dont know if its possible or maybe i was posting in the wronng groups. Ok well I have a asp script going on my works...
5
by: Greg Collins [MVP] | last post by:
I have an ASP.NET page that uses a tag: <asp:Xml id="foo" runat="server" DocumentSource="rss.xml" TransformSource="rss20.xsl" /> This creates a Web page from an XML file that was generated by...
3
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code:...
0
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
0
by: teddysnips | last post by:
I have Search form that allows users to retrieve records into a DataGrid. There are two search criteria - a Month and a Year, which are selected from drop-down lists. There is a server-side...
5
by: widevision7 | last post by:
I am creating a web site where I want to have a hyperlink that executes a Perl script. At the same time, I want to pass along a variable inside of the hyperlink that the Perl script can use when it...
1
by: abertay | last post by:
Hi friends...I need our help.I'm stuck with this code... can some one tell me how can pass a javascript variable into hyperlink along with a php varaible? Here is my code.. <html> <head>...
2
by: =?Utf-8?B?REo=?= | last post by:
I have a peculiar problem here that I did not have until I migrated from ASP.NET 2.0 to 3.5. I use a master page for my application. Because the master page uses update panels I have the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.