Gossamer Forum
Home : Products : DBMan : Customization :

Category as variable in URL

Quote Reply
Category as variable in URL
Hello all,

I hope I can explain this so it makes sense Smile
I am definitely not a competent Perl programmer but I've seen that a lot of you are. Here's what I'd like to be able to do :

I have a situation where my $in{'Category'} needs to be passed as a variable into a DBman query URL.
Problem is some of my Categories contain spaces ie: 'PC Parts' and that doesn't work when passed into a URL. So what I need to do is in the instances when I'm going to pass my Category variable into a URL, parse it and check for a space and replace the space with the "+" sign ie:

&parse_category
if $in{'Category'} contains space
parse it so the space is replaced with +
let $parsed_category = the parsed Category name now containing the + sign

Make any sense? I hope so.
Thanks you much for any help you may be able to throw my way.
Quote Reply
Re: Category as variable in URL In reply to
You can use this code to replace the space with a + character:

Code:
$rec{'Category'} =~ s/ /+/g;

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited July 06, 1999).]