Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
kenji776 #1
Adding to the session variable
Yeah that is pretty much my questions. I am building a web playlist, and I need
a way for people to add songs to it. So what I have is a checkbox by every
song, and then the ones they check get added to a playlist session variable. My
question is, how do I ADD the form contents to the session variable, without
deleteing the old stuff. I have tried the following things
<cfset #session.playwhat# = #session.playwhat# + form.playwhat>
and
<cfset session.playwhat = Structappend(session.playwhat,form.playwhat)>
neither of those have worked. How to I do it?
kenji776 Guest
-
#39634 [NEW]: session variable and normal variable
From: erhanbaris at gmail dot com Operating system: Win Xp SP1 PHP version: 5.2.0 PHP Bug Type: Variables related Bug... -
Adding Double Quotes to variable
I currently have a variable called $servicename. Example: SNMP Service = $servicename How can add double qoutes around "SNMP Service" to the... -
adding text to variable
I have an email login screen that sends the username and password to an authentication screen. I designate the username with the name of the input,... -
Datalist - how (if) to use a sub variable or session variable in the footer?
Hi, sorry to be greedy with all my posts lately, but can you tell I'm doing new things this week? I've just done my first datalist (a simple... -
[SESSION] Session variable deleted prior to command?
Hi all, I'm developing a database system on my local computer (OS/version details at bottom) with a simple user authentication using sessions. On... -
bill_doe #2
Re: Adding to the session variable
Try:
<cfset #session.playwhat# = #session.playwhat# & form.playwhat>
bill_doe Guest
-
kenji776 #3
Re: Adding to the session variable
Thank that worked like a charm. Now another thing. What would be a good way to
keep boxes check that have already checked so they don't check then again. Like
say they chooose some songs from the F section, then go to the G section choose
some more, and then go back to F, I want the songs they choose in F to stay
checked. I know there is some kind of way to read from the session variable and
find out whether it should be checked or not. Here is the code I use to make
the checkboxes.
<form name="form" method="post">
<cfdirectory action="list" directory="d:\ftp\digital
swordsmen\downloads\music\" name="music_dump" filter="*.mp3">
<cfloop query="music_dump">
<cfif Left(#music_dump.name#, 1) EQ #url.letter#>
<cfoutput>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"><a href="../Downloads/music/#music_dump.name#"
target="_blank"><img src="IMG/AlienDe0.gif" width="12" height="12"
border="0"></a></td>
<td width="450"><a
href="../Downloads/music/#music_dump.name#">#music_dump.name#</a></td>
<td width="15"><input type="checkbox" name="Playwhat" id="playwhat"
value="Songname_#music_dump.name#"> </td>
</tr>
</table>
</cfoutput>
<cfelse>
</cfif>
</cfloop>
<br>
<input name="Playsongs" type="submit" id="Playsongs" value="Play songs in
list">
<input name="addsongs" type="submit" id="addsongs" value="Add songs to list
and keep browsing">
</form>
kenji776 Guest
-
OldCFer #4
Re: Adding to the session variable
If you use
<cfset #session.playwhat# = #session.playwhat# & form.playwhat>
How can you tell where the name of 1 song starts and another begins. I would
think
you should use a list.
<cfset session.playwhat = ListAppend(session.playlist,form.playlist)>
You shouldn't put pound signs on the left side of the cfset assignment.
OldCFer Guest
-
kenji776 #5
Re: Adding to the session variable
Hmm. I though the songs would be seperated by commas when stored in the session
variable like that. I mean i dumped the variable afterwards and i saw
song1.mp3,song2.mp3,song3.mp3 and so on, so like it does seperate with commas.
Does the listing way do something better? Not trying to like question you or
anything, just trying to figure out why that is the better way to do it. Thanks
for the help.
kenji776 Guest
-
OldCFer #6
Re: Adding to the session variable
The only way you would get commas in there is if you have multiple fields named
form.playwhat.
<cfset x = "mary">
<cfset x = x & "jane">
produces "maryjane" not "mary,jane". "&" means put the two strings together,
not separate them with a comma.
OldCFer Guest
-
kenji776 #7
Re: Adding to the session variable
Wouldn't I want them seperated by commas so when i go to feed them into a media player I can use a comma delimited loop?
kenji776 Guest



Reply With Quote

