• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 414
  • Last Modified:

passing form values to cfhttp request as comma delimited

hi experts. too much beer and my lost mind. i have a form field. a select menu where i can select multiple items. on the click of a button, i want to pass the selected items as a comma delimited list. i am confused, i tried using a loop but it failed:

here is what i tried.
<cfloop list="form.selectusers" index="k">
  <cfhttp url="http://smslane.com/vendorsms/pushsms.aspx?user=abc&password=xyz&msisdn=#k#&sid=WebSMS
but i want to pass something like this:
  <cfhttp url="http://smslane.com/vendorsms/pushsms.aspx?user=abc&password=xyz&msisdn=996734673,99374673,7364387483&sid=WebSMS
like multiple mobile numbers using comma separation. how can i do that. plea guide me

Open in new window

Gurpreet Singh Randhawa
Gurpreet Singh Randhawa
1 Solution
Firstly, you're missing # # in your cfloop, should be:
<cfloop list="#form.selectusers#" index="k">

But, if form.selectusers is a list of multiple items, you don't even need that loop.  Just try:
  <cfhttp url="http://smslane.com/vendorsms/pushsms.aspx?user=abc&password=xyz&msisdn=#form.selectusers#&sid=WebSMS&msg=#form.message#&fl=0"></cfhttp>  

always remember, don't drink and code :)
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
Thanks! Well i realize that Beer affect my brain a lot. :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now