I'm designing a website for an eZine and am trying to implement a myCalendar type deal.
my intention originally was to send the details of the event to store via URL to a writeCookie.asp page and store each date the user wanted on their machine. i tried and ran into a problem.
each time i write the cookie the old one gets overwritten then there's only one event stored at all times.
how can i get around this?
can i dynamically name a cookie?
thanks,
sorry if this is in the wrong forum.Got it fixed:
________________________________
Rather than using Response.Cookies("date") each time to store another date you could use it to count the number of dates that have been chosen so far.
So For example you could use the following code when storing a date:
// If there are no current dates stored
If Request.Cookies("date") = "" Then
// Store the date in the first position
Response.Cookies("date1")("venue") = "venue"
Response.Cookies("date1")("time") = "time"
Response.Cookies("date1")("misc") = "misc"
// This stores the number of the last date entry made
Response.Cookies("date") = "1"
// Else there is already at least one date stored so get the next number
Else
// Increment the date entry counter
Response.Cookies("date") = Request.Cookies("date") + 1
// Store the date in the first position
Response.Cookies("date" & Request.Cookies("date"))("venue") = "venue"
Response.Cookies("date" & Request.Cookies("date"))("time") = "time"
Response.Cookies("date" & Request.Cookies("date"))("misc") = "misc"
End If
So the first date you will have
Response.Cookies("date1")("venue") = "venue1"
Response.Cookies("date1")("time") = "time1"
Response.Cookies("date1")("misc") = "misc1"
the second date
Response.Cookies("date2")("venue") = "venue2"
Response.Cookies("date2")("time") = "time2"
Response.Cookies("date2")("misc") = "misc2"
the third date
Response.Cookies("date3")("venue") = "venue3"
Response.Cookies("date3")("time") = "time3"
Response.Cookies("date3")("misc") = "misc3"
and so on
Then when you want to read the dates you could use
For i = 1 To Request.Cookies("date")
Response.Write Request.Cookies("date" & i)("venue")
Response.Write Request.Cookies("date" & i)("time")
Response.Write Request.Cookies("date" & i)("misc")
Nextnice fix, Dirk and thanks for posting it.
I've been gone for the last couple days but was going to do a little research to help out, but it looks like you're all GOOD `
my intention originally was to send the details of the event to store via URL to a writeCookie.asp page and store each date the user wanted on their machine. i tried and ran into a problem.
each time i write the cookie the old one gets overwritten then there's only one event stored at all times.
how can i get around this?
can i dynamically name a cookie?
thanks,
sorry if this is in the wrong forum.Got it fixed:
________________________________
Rather than using Response.Cookies("date") each time to store another date you could use it to count the number of dates that have been chosen so far.
So For example you could use the following code when storing a date:
// If there are no current dates stored
If Request.Cookies("date") = "" Then
// Store the date in the first position
Response.Cookies("date1")("venue") = "venue"
Response.Cookies("date1")("time") = "time"
Response.Cookies("date1")("misc") = "misc"
// This stores the number of the last date entry made
Response.Cookies("date") = "1"
// Else there is already at least one date stored so get the next number
Else
// Increment the date entry counter
Response.Cookies("date") = Request.Cookies("date") + 1
// Store the date in the first position
Response.Cookies("date" & Request.Cookies("date"))("venue") = "venue"
Response.Cookies("date" & Request.Cookies("date"))("time") = "time"
Response.Cookies("date" & Request.Cookies("date"))("misc") = "misc"
End If
So the first date you will have
Response.Cookies("date1")("venue") = "venue1"
Response.Cookies("date1")("time") = "time1"
Response.Cookies("date1")("misc") = "misc1"
the second date
Response.Cookies("date2")("venue") = "venue2"
Response.Cookies("date2")("time") = "time2"
Response.Cookies("date2")("misc") = "misc2"
the third date
Response.Cookies("date3")("venue") = "venue3"
Response.Cookies("date3")("time") = "time3"
Response.Cookies("date3")("misc") = "misc3"
and so on
Then when you want to read the dates you could use
For i = 1 To Request.Cookies("date")
Response.Write Request.Cookies("date" & i)("venue")
Response.Write Request.Cookies("date" & i)("time")
Response.Write Request.Cookies("date" & i)("misc")
Nextnice fix, Dirk and thanks for posting it.
I've been gone for the last couple days but was going to do a little research to help out, but it looks like you're all GOOD `