View Full Version : Resolved Sending a name instead of id in a function

09-01-2011, 02:27 AM
Is it possible to send a name of an item through a GET method, to a function, instead of the classic id?

The link is like this

equipinv.php?x=burn:Blunt Dagger

Is it possible to click a link and have it find that name in a query and display it?
It'd be the same as $id which would look like:


But I need it to show the name, and the name has spaces.

Chris Hick
09-01-2011, 04:07 AM
Sure, its simple really. You could use something like this when a user clicks on an item:


Then, use the get method to retrieve the variable:

$inv = $_GET["x"];

Then, use str_replace to replace the _ with a space:

$newInv = str_replace("_", "", $inv);

09-01-2011, 01:38 PM
Thanks I will try that, the reason it needs the space is because it has to match the database value exactly by name.

09-01-2011, 01:44 PM

09-01-2011, 02:06 PM
Perfect, thanks guys