Dynadot โ€” .com Registration $8.99

PHP: URL data problem. Little help if possible.

Spaceship Spaceship
Watch
Impact
0
Hi guys.

I thought I would turn to here so that I could get some advice off you lot as you can be very experienced in this subject.

Ok so I have a big problem. I have created a link which looks like:

<a href="productPage.php?NAME=<?php echo $name; ?>&IMAGEURL=<?php echo $imageurl; ?>"> <?php echo $name; ?> </a>

Now this works fine and it pulls the information from my database. But when I have all the information being passed over to the 'productPage' the URL becomes to big and won't view properly in any of the browsers. This is because most URL have a large cap of around 3k words or even below that.

I need a way of which when I click on the link, it passed data to the 'productPage' but does not use tons of code in the URL. I'm not sure if this can be done with cookies or sessions but it seems likely.

Any help would be amazing, thank you.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
There is a limit of 2048 characters for GET requests as per HTTP standard.
Normally it's enough the pass the product ID in the URL, then the target page should fetch the product info from the DB. You can also create SEO-friendly URLs like this.
 
0
•••
as already suggested, easiest and best thing to do is only pass a key that can be used to query the database and get the rest of the info.

if however you absolutely must still pass all the data, switch to using post and use javascript to submit the form when the link is clicked.
 
0
•••
Umm.

Umm using another language might be the key to be honest. Good call.

I'm working on a affiliate wesbite ya-see, and the buyurl and imageurl in the database are massive in length.

Thanks a lot guys.
 
0
•••
You're bound to have problems with URLs that long.
Honestly I can't see the justification for it.
 
0
•••
You're bound to have problems with URLs that long.
Honestly I can't see the justification for it.

I can't believe that the URL would be even close to 2K!

------

As far as the solution goes - you store the name/url pair in a table - there's no reason you couldn't create and autogenerated key (ID ) anyway.

That said - if your query access is via a long string like that it won't be long before your indexes get huge and useless.

You could also do url rewrites, shortening services, meta refreshes etc to try and mask the affiliate url.

Here's a TIP

if you implement your own url-shortener/expander on your site then no one can remove your affiliate link.


J.
 
Last edited:
0
•••
The site is already in php. It wouldn't be too much work to pass the id only and then pull the data from the database via the id.
 
0
•••
Thanks for the responses guys, gives me some stuff to think about.

As I said above, the URLs can be massive due to the long links provided by the affiliate supplier. Alls I want is all the information to pass over to another page when I click on a link, I guess I'll use another language or look into optimizing my database so that I can drag information through from an ID of some sort.
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back