473,230 Members | 1,541 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,230 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 1710
"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: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...

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.