Page 1 of 1
Shorten My URL's
Posted: Thu Dec 30, 2010 2:15 pm
by sdaztec
I've been working on my website wile learning php, I am a noob, so please forgive me if my terminology is horrible.
I've got everything working decently, but my one major issue is my url string is HUGE! I passed all my variables through the URL, but I think it would be better to pass 1 or 2 variables and then call the rest of the information from the database.
Is this a difficult task? Can someone assist me in what steps I need to take?
Thanks!
Re: Shorten My URL's
Posted: Thu Dec 30, 2010 4:35 pm
by Sofw_Arch_Dev
Without knowing the nature of the URLs I'm guessing that a URL in question is NOT the result of an HTML form submission since you could use
in your HTML form, which would circumvent the problem you're having.
If your PHP code is being triggered from HTML links with long query strings, such as
Code: Select all
<a href="myPHP.php?param1=something¶m2=somethingelse¶m3=etcetera_etcetera"> link </a>
you could construct separate HTML form elements using the POST method for each intended link, supply the parameters to your PHP in hidden HTML input elements in each separate form, set the action to be your PHP code, and either use the standard HTML button to trigger the submission OR if that's too ugly, create styled HTML anchor tags with onclick() ( click() in jQuery) functions that trigger individual form submission.
What's the nature of the long URLs?
Re: Shorten My URL's
Posted: Thu Dec 30, 2010 7:51 pm
by thecodewall
Re: Shorten My URL's
Posted: Thu Dec 30, 2010 8:41 pm
by mellowman
I write a blog entry about passing sensitive data as well as shorting up your url into an algorithm.
http://favoriteplaylist.com/developmentblog/?p=32