Forum Moderators: open

Message Too Old, No Replies

Taking info from the URL in the address

How to do it

         

Marz5

7:40 pm on Aug 9, 2006 (gmt 0)

10+ Year Member



My first post question and i dont know exactly how to express what I need!

Assume we are in URL showing a photo for sale.
www.example.com/Image105/Smallparts/part6.html

There are many photos on the site all in the format Image(nnn) and part(#).html. I need to fetch nnn and # to be used in a following linked webpage upon clicking a link.

So back to the example, the client is on image105/ part 6 and clicks the buy photo button so as he comes into a payment form URL, eg:

www.secure.example.com/payform

In this form, I need to indicate or show the image the user is going to buy (nnn, #) by having it implimented in the code either as (1):

Preview image you are buying : <a href="www.example.com/Image105/smallparts/part6.html> click here </a> (so as he see the photo in a webpage)

or an indication code (2):

You are buying "part6" of the main image "Image105"

I was informed that one can fetch pieces or parts from the URL address and use it in the html code of the next page upon clicking a link.

How it can be done!

[edited by: encyclo at 10:59 pm (utc) on Aug. 9, 2006]
[edit reason]
[1][edit reason] examplified [/edit]
[/edit][/1]

LifeinAsia

8:28 pm on Aug 9, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You have 2 main choices:
1) Use a scripting language (PHP, ASP, Cold Fusion, etc.).
2) Use mod rewrite (if using Apache or a hacked version if using another web server).

scintex

11:55 am on Aug 10, 2006 (gmt 0)

10+ Year Member



I am not 100% if this would work as it depends largly on what your payment processor is expecting in terms of variables.

I suppose (without scripting), have each image/part as a form.

If for example you have ImageX page which has smaller pictures on it that are numbered (your parts), then you could for each part have:

Image number
Part number
Buy button

...On a form. you'll have one form per part (each with the above fields) which you would probably have to manually code. When you click 'buy' the form passes the varibles to the payment form.

This is just an idea to get you thinking- as I mentioned above it does depend on how your payment form works. You'll also have to think about data sanitisation- e.g. what happens if I pass invalid IDs to the payment form? What counts as invalid/valid?

With scripting, you can add more bells and whistles and it would make this solution more dynamic and graceful and a better best practice solution. Also, you wouldn't have to code every form :)

S

Marz5

11:05 am on Aug 22, 2006 (gmt 0)

10+ Year Member



Sorry for the delay getting back.

I decided for a slightly different strategy since I think what I was asking originally was difficult or too complex.

Instead of passing the code onto the next form, I want to automatically generate a code on the image .html file itself, and then the buyer will copy the corresponding code onto the form upon clicking the buy button.

So imagine we are in the html file:
example.com/NAME/Pics/CODE1/F/FT01.html

which displays the pic, info, etc etc...

As said the file structure format is always like this on my entire photogallery site

Now I need to extract "CODE1" and "FT01" (or "01") and at the end of this html file I include some java script or any html code so as automatically, I would have

Picture Order code : "CODE1-FT##" or CODE-##"

The buyer copies this code and types it on the form himself. However I cannot do this manually for my 2200 pics!

Hope this is possible someway!

[edited by: encyclo at 12:01 pm (utc) on Aug. 22, 2006]
[edit reason]
[1][edit reason] examplified (see forum charter) [/edit]
[/edit][/1]