Skip to main content
Participant
June 21, 2007
Question

Using URL ID to specify an email address and a subject line.

  • June 21, 2007
  • 4 replies
  • 728 views
Hi, I'm a student working in my University's Library. They are looking for a coldfusion solution to send e-mails directly from their website. Here's the catch, in my database (which I haven't set up yet) I'm thinking of giving each e-mail address an ID number, then in a separate table in the same db, giving each subject line an ID also. This way i can assign any subject line to any e-mail address.

So my link to get to my coldfusion will look something like this: (first number is the address, second number is the subject)

http://www.cybrarianprof.org/perform/send_email.cfm?id=9,1

Is it possible to token-ize my URL ID into the two numbers so I can get ColdFusion to understand them? How do I parse the URL id?

(sorry if this sounds kind of scattered, I'm really new to this whole web development thing...)
This topic has been closed for replies.

4 replies

Inspiring
June 21, 2007
ptrott wrote:
> so a URL id is data type string... i think i understand it now. that makes
> things a little easier. Once I figure out how to parse this thing, it will be a
> piece of cake. I'm still trying to figure this all out, but if you could, would
> you be able to elaborate a little on CF list functions? What would be a good
> one to use to separate my URL id into separate variables? Also, what is a good
> delimiter to use in this situation?
>

I don't recall if a comma is consider an illegal character in the URL
parameter specification. But assuming it is not...

<cfset foo = listFirst(url.id)>
<cfset bar = listLast(url.id)>
<cfset george = listGetAt(url.id,1)>
<cfloop list="#url.id#" index="value">
<cfoutput>#value#</cfoutput><br/>
</cfloop>

This of course assuming you don't just set separate URL variable as
Jazzy suggested.
Inspiring
June 21, 2007
Try it some like this:
http://www.mydomain.com/newsletter/sendemail?id=9&subjectID=1

just a thought


ptrott wrote:
> so a URL id is data type string... i think i understand it now. that makes
> things a little easier. Once I figure out how to parse this thing, it will be a
> piece of cake. I'm still trying to figure this all out, but if you could, would
> you be able to elaborate a little on CF list functions? What would be a good
> one to use to separate my URL id into separate variables? Also, what is a good
> delimiter to use in this situation?
>
ptrottAuthor
Participant
June 21, 2007
so a URL id is data type string... i think i understand it now. that makes things a little easier. Once I figure out how to parse this thing, it will be a piece of cake. I'm still trying to figure this all out, but if you could, would you be able to elaborate a little on CF list functions? What would be a good one to use to separate my URL id into separate variables? Also, what is a good delimiter to use in this situation?
Inspiring
June 21, 2007
In your example, url.ID is going to return the string "9,1". You can
easily treat this as a list and use any of the ColdFusion list functions
to manipulate it in many ways.

The comma may not be a good choice for a URL string, I am not sure. But
the CF list functions allow you to set any value as a delimiter if you
need to use a different character.