November 21st, 2012, 07:33 AM
How to get more data in URL
I have product page that returns url like this
How can I, using PHP get more data in URL like product name.
I do not need rewrite or SEO friendly URL, just need beside id, product name in any format.
I appreciate any help, thanks
November 21st, 2012, 07:46 AM
Passing parameters in the URL uses the get method in PHP. You can add any additional parameters you want by separating them with '&'. So your URL might look like:
Note the use of %20 to represent a space (you could also have used '+'). It is important to not use reserved characters within parameters you are trying to pass. When generating the URL in PHP you should pass that part of the URL string through 'urlencode'. If generating the URL manually then you should look at this to make sure you don't get unexpected results.
As an aside, keep in mind that anyone can manipulate URLs to try to hack your site. Never put any sensitive data into a URL nor trust any strings in the URL (validation checking is critical to security when using the get method).
Comments on this post
Last edited by gw1500se; November 21st, 2012 at 07:49 AM.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
November 21st, 2012, 08:20 AM